-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore:heroku env vars update script (#1334)
* chore: script for updating env vars for a review app * chore: add instructions to script
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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." |