-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6da7a7a
commit 7a4fd76
Showing
3 changed files
with
59 additions
and
2 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
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,12 @@ | ||
{ | ||
"url": "", | ||
"secret": "c5502d62-84a5-41f1-87eb-ee33a76fb7bc", | ||
"database": "redis", | ||
"redis": { | ||
"host": "", | ||
"port": "", | ||
"password": "", | ||
"database": "0" | ||
}, | ||
"port": "4567" | ||
} |
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,40 @@ | ||
#!/bin/bash | ||
|
||
# Check that environment variables have been defined | ||
if [[ -z "${REDIS_HOST+x}" ]]; then | ||
# var is not defined | ||
echo "Error: REDIS_HOST is not defined!" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${REDIS_PORT+x}" ]]; then | ||
# var is not defined | ||
echo "Error: REDIS_PORT is not defined!" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${REDIS_PASSWORD+x}" ]]; then | ||
# var is not defined | ||
echo "Error: REDIS_PASSWORD is not defined!" | ||
exit 1 | ||
fi | ||
|
||
if [[ -z "${DEPLOYMENT_URL+x}" ]]; then | ||
# var is not defined | ||
echo "Error: DEPLOYMENT_URL is not defined!" | ||
exit 1 | ||
fi | ||
|
||
# Read the JSON file | ||
json_data=$(cat "/usr/src/app/config_template.json") | ||
|
||
# Update the JSON file with the environment variables | ||
json_data=$(jq --arg deployment_url "$DEPLOYMENT_URL" '.url = $deployment_url' <<< "$json_data") | ||
json_data=$(jq --arg host "$REDIS_HOST" '.redis.host = $host' <<< "$json_data") | ||
json_data=$(jq --arg port "$REDIS_PORT" '.redis.port = $port' <<< "$json_data") | ||
json_data=$(jq --arg password "$REDIS_PASSWORD" '.redis.password = $password' <<< "$json_data") | ||
|
||
# Write the updated JSON file to config.json | ||
echo "$json_data" > "/usr/src/app/config.json" | ||
|
||
cat /usr/src/app/config.json |