20 lines
506 B
Bash
20 lines
506 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
: "${API_HOST:=http://localhost}"
|
|
: "${API_PORT:=7070}"
|
|
# Create runtime config file in writable location
|
|
cat > /runtime-config/config.js <<EOF
|
|
window.__APP_CONFIG__ = {
|
|
API_HOST: "${API_HOST}",
|
|
API_PORT: "${API_PORT}"
|
|
};
|
|
EOF
|
|
|
|
# Generate nginx config from template (if using)
|
|
if [ -f "/etc/nginx/templates/nginx.conf.template" ]; then
|
|
envsubst '${API_HOST} ${API_PORT}' < /etc/nginx/templates/nginx.conf.template > /etc/nginx/nginx.conf
|
|
fi
|
|
|
|
# Start Nginx
|
|
exec nginx -g "daemon off;" |