fix(docker): harden frontend runtime config

This commit is contained in:
2026-07-11 22:03:24 +02:00
parent 3d939426b1
commit 715de6649b
9 changed files with 75 additions and 11 deletions
+8 -3
View File
@@ -2,8 +2,13 @@
set -eu
backend_base_url=${BACKEND_BASE_URL:-/api}
escaped_backend_base_url=$(printf '%s' "$backend_base_url" | sed 's/[&|\\]/\\&/g')
sed "s|__BACKEND_BASE_URL__|${escaped_backend_base_url}|g" \
/usr/share/nginx/html/config.template.js > /usr/share/nginx/html/config.js
runtime_config=$(jq -cn --arg backend_base_url "$backend_base_url" \
'{backendBaseUrl: $backend_base_url}')
printf 'window.__THOTHII_CONFIG__ = %s;\n' "$runtime_config" \
> /usr/share/nginx/html/config.js
if [ "$#" -gt 0 ]; then
exec "$@"
fi
exec nginx -g 'daemon off;'