-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ability to supply settings file via volume
- means we only do the default settings file stuff if no file is detected
- Loading branch information
1 parent
712281d
commit 1f4b278
Showing
3 changed files
with
14 additions
and
5 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
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 |
---|---|---|
@@ -1,16 +1,25 @@ | ||
#!/bin/sh -eu | ||
|
||
if [ ! -e /usr/local/apache2/htdocs/operationsgateway/operationsgateway-settings.json ] | ||
|
||
then | ||
|
||
# file doesn't exist, so go with default settings file with env variable substitution | ||
# if file exists, we skip this code as that means we've been supplied one from a mount | ||
|
||
# Use a tempfile instead of sed -i so that only the file, not the directory needs to be writable | ||
TEMPFILE="$(mktemp)" | ||
|
||
# Set values in operationsgateway-settings.json from environment variables | ||
sed -e "s|\"apiUrl\": \".*\"|\"apiUrl\": \"$API_URL\"|" \ | ||
-e "s|\"pluginHost\": \".*\"|\"pluginHost\": \"/operationsgateway\"|" \ | ||
/usr/local/apache2/htdocs/operationsgateway/operationsgateway-settings.json > "$TEMPFILE" | ||
/usr/local/apache2/htdocs/operationsgateway/operationsgateway-settings.example.json > "$TEMPFILE" | ||
|
||
cat "$TEMPFILE" > /usr/local/apache2/htdocs/operationsgateway/operationsgateway-settings.json | ||
|
||
rm "$TEMPFILE" | ||
|
||
fi | ||
|
||
# Run the CMD instruction | ||
exec "$@" |