diff options
author | vnugent <public@vaughnnugent.com> | 2024-08-17 22:00:42 -0400 |
---|---|---|
committer | vnugent <public@vaughnnugent.com> | 2024-08-17 22:00:42 -0400 |
commit | d388c7757010156bd79d4c2fb3cc812c91a4683d (patch) | |
tree | 3a9f34287168e36ce2ec7e48c3563144eb0d92d8 /ci/container/run.sh | |
parent | f0d91ad12e3a01118357b0cbf2aabbcd7464028f (diff) |
package and configuration update for upstream updatesnext
Diffstat (limited to 'ci/container/run.sh')
-rw-r--r-- | ci/container/run.sh | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/ci/container/run.sh b/ci/container/run.sh index d829509..8e4f3cd 100644 --- a/ci/container/run.sh +++ b/ci/container/run.sh @@ -2,6 +2,18 @@ #this script will be invoked by dumb-init in the container on statup and is located at /app +substitute_config_file() { + local templateFilePath="$1" + local outputFilePath="$2" + + # Substitute environment variables with their values or default values + while IFS= read -r line; do + # Use pattern matching and parameter expansion to handle defaults + modifiedLine=$(echo "$line" | sed -E 's/\$\{([^:-]+)(:-([^}]+))?\}/$(echo "${\1:-\3}")/ge') + eval "echo \"$modifiedLine\"" + done < "$templateFilePath" > "$outputFilePath" +} + echo "Generating configuration files" rm -rf config && mkdir config @@ -11,7 +23,7 @@ cp config-templates/routes.xml config/routes.xml #substitude all -template files in the config-templates dir and write them to the config dir for file in config-templates/*-template.json; do - envsubst < $file > config/$(basename $file -template.json).json + substitute_config_file $file config/$(basename $file -template.json).json done echo "Complete" |