Simple implementation of LACONIC_HOSTED_ENDPOINT (#342)

This commit is contained in:
David Boreham 2023-04-17 20:46:05 -06:00 committed by GitHub
parent 99aa1fa27e
commit 172300d7bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

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

View File

@ -26,9 +26,10 @@ do
kv_pair=(${kv_pair_string//=/ }) kv_pair=(${kv_pair_string//=/ })
template_string_to_replace=${kv_pair[0]} template_string_to_replace=${kv_pair[0]}
template_value_to_substitute=${kv_pair[1]} 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 # Run find and sed to do the substitution of one variable over all files
# See: https://stackoverflow.com/a/21479607/1701505 # 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. # 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 done

View File

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