Simple implementation of LACONIC_HOSTED_ENDPOINT #342

Merged
telackey merged 1 commits from dboreham/add-hosted-endpoint into main 2023-04-18 02:46:05 +00:00
3 changed files with 7 additions and 4 deletions

View File

@ -2,5 +2,7 @@ services:
laconic-console:
restart: unless-stopped
image: cerc/laconic-console-host:local
environment:
- LACONIC_HOSTED_ENDPOINT=${LACONIC_HOSTED_ENDPOINT:-http://localhost}
ports:
- "80"

View File

@ -26,9 +26,10 @@ do
kv_pair=(${kv_pair_string//=/ })
template_string_to_replace=${kv_pair[0]}
template_value_to_substitute=${kv_pair[1]}
template_value_to_substitute_expanded=${template_value_to_substitute//LACONIC_HOSTED_ENDPOINT/${LACONIC_HOSTED_ENDPOINT}}
# Run find and sed to do the substitution of one variable over all files
# See: https://stackoverflow.com/a/21479607/1701505
echo "Substituting: ${template_string_to_replace} = ${template_value_to_substitute}"
echo "Substituting: ${template_string_to_replace} = ${template_value_to_substitute_expanded}"
# Note: we do not escape our strings, on the expectation they do not container the '#' char.
find ${webapp_files_dir} -type f -exec sed -i 's#'${template_string_to_replace}'#'${template_value_to_substitute}'#g' {} +
find ${webapp_files_dir} -type f -exec sed -i 's#'${template_string_to_replace}'#'${template_value_to_substitute_expanded}'#g' {} +
done

View File

@ -2,5 +2,5 @@
services:
wns:
server: 'http://localhost:9473/api'
webui: 'http://localhost:9473/console'
server: 'LACONIC_HOSTED_ENDPOINT:9473/api'
webui: 'LACONIC_HOSTED_ENDPOINT:9473/console'