ghost-portal/env.sh
Chevdor 19f409023c
Add ENV support to the generated site (#2450)
* WIP Add ENV support to the generated site

* At that point, the ENV make it as JS script inside the container but are not picked up yet

* Fix code to fetch WS_URL from our imported ENV

* Cleanup

* Fix Dockerfile and add doc

* Cleanup of the shell script
2020-04-25 08:29:59 +02:00

21 lines
387 B
Bash
Executable File

#!/bin/bash
# This script is used when the docker container starts and does the magic to
# bring the ENV variables to the generated static UI.
TARGET=./env-config.js
# Recreate config file
echo -n > $TARGET
declare -a vars=(
"WS_URL"
"SAMPLE"
)
echo "window.process_env = {" >> $TARGET
for VAR in ${vars[@]}; do
echo " $VAR: \"${!VAR}\"," >> $TARGET
done
echo "}" >> $TARGET