Load env var for api url into ui for production
This commit is contained in:
23
nginx/scripts/01-setup.sh
Executable file
23
nginx/scripts/01-setup.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
mkdir -p /etc/nginx/templates
|
||||
|
||||
if [ "$NGINX_SSL_ENABLED" = "true" ]; then
|
||||
echo "Using SSL configuration"
|
||||
cp /templates/ssl.conf.template /templates/default.conf.template
|
||||
else
|
||||
echo "Using non-SSL configuration"
|
||||
cp /templates/nossl.conf.template /templates/default.conf.template
|
||||
fi
|
||||
|
||||
if [ "$ENVIRONMENT" = "production" ]; then
|
||||
export UI_ROOT="/usr/share/nginx/html"
|
||||
envsubst '${VITE_API_URL}' < /usr/share/nginx/html/config.template.js > /usr/share/nginx/html/config.js
|
||||
echo "Setting production root to ${UI_ROOT}"
|
||||
else
|
||||
export UI_ROOT="/home"
|
||||
echo "Setting development root to ${UI_ROOT}"
|
||||
fi
|
||||
|
||||
envsubst '$UI_ROOT' < /templates/default.conf.template > /etc/nginx/templates/default.conf.template
|
||||
Reference in New Issue
Block a user