Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore:heroku env vars update script #1334

Merged
merged 2 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions scripts/.env.heroku
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
SNAPSHOT_STATUS_ENABLED='true'
SNAPSHOT_STATUS_MAX_ERROR_BUFFER_SIZE=30
SNAPSHOT_STATUS_ERROR_RATE_THRESHOLD=0.33
25 changes: 25 additions & 0 deletions scripts/update-env-vars.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# To run this script:
# - jq for parsing JSON (sudo apt-get install jq or brew install jq)
# - heroku CLI installed and authenticated
# - awk should already be on your system
# Put in the .env.heroku all the variables your want to add or overwrite to the review app

TARGET_APP=$1

if [[ -z "$TARGET_APP" ]]; then
echo "Missing app name"
exit 1
fi

EXISTING_VARS=$(heroku config --json --app=${TARGET_APP} | jq -r 'to_entries|map("\(.key)=\(.value)")|.[]')
NEW_VARS=$(awk -F= '/.+/ { print $1"="$2 }' ./.env.heroku)
MERGED_VARS=$(echo -e "${EXISTING_VARS}\n${NEW_VARS}")

# Update env vars for the specified review app
echo "Updating env vars for ${TARGET_APP}..."
heroku config:set --app=${TARGET_APP} ${MERGED_VARS}
echo "Env vars updated for ${TARGET_APP}"

echo "You're good."
Loading