24 lines
549 B
Bash
24 lines
549 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# Generate env.js from API_BASE environment variable
|
|
# This is set in the Helm deployment values
|
|
TARGET="/usr/share/nginx/html/env.js"
|
|
|
|
# API_BASE should be set via deployment env (e.g., from Helm values)
|
|
# Default to /api as fallback (relative path)
|
|
: ${API_BASE:=/api}
|
|
|
|
echo "Generating env.js with API_BASE=${API_BASE}"
|
|
|
|
cat > "$TARGET" <<EOF
|
|
window.__ENV__ = {
|
|
API_BASE: "${API_BASE}"
|
|
};
|
|
EOF
|
|
|
|
echo "✓ env.js generated at $TARGET"
|
|
|
|
# Ensure ownership/permissions for nginx
|
|
chown -R nginx:nginx /usr/share/nginx/html || true
|