21 lines
586 B
Bash
21 lines
586 B
Bash
|
|
#!/bin/sh
|
||
|
|
# Generates the SPA's runtime configuration from container environment
|
||
|
|
# variables (nginx image runs every /docker-entrypoint.d/*.sh on start).
|
||
|
|
set -e
|
||
|
|
|
||
|
|
API_SCOPE="${ENTRA_API_SCOPE}"
|
||
|
|
if [ -z "$API_SCOPE" ] && [ -n "$ENTRA_CLIENT_ID" ]; then
|
||
|
|
API_SCOPE="api://${ENTRA_CLIENT_ID}/access_as_user"
|
||
|
|
fi
|
||
|
|
|
||
|
|
cat > /usr/share/nginx/html/config.js <<EOF
|
||
|
|
window.__APP_CONFIG__ = {
|
||
|
|
authMode: "${AUTH_MODE:-entra}",
|
||
|
|
tenantId: "${ENTRA_TENANT_ID}",
|
||
|
|
clientId: "${ENTRA_CLIENT_ID}",
|
||
|
|
apiScope: "${API_SCOPE}"
|
||
|
|
};
|
||
|
|
EOF
|
||
|
|
|
||
|
|
echo "[frontend] config.js generated (authMode=${AUTH_MODE:-entra})"
|