Load env var for api url into ui for production

This commit is contained in:
2025-04-14 23:37:47 -04:00
parent 9ad87fbac5
commit c2e9e098ed
5 changed files with 9 additions and 3 deletions

23
nginx/scripts/01-setup.sh Executable file
View 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