22 lines
790 B
Bash
22 lines
790 B
Bash
|
|
#!/bin/sh
|
||
|
|
# Writes the runtime configuration the page reads before the bundle runs, then
|
||
|
|
# hands over to nginx.
|
||
|
|
#
|
||
|
|
# The front end is built once and served by many environments, so anything that
|
||
|
|
# differs between them has to be resolved here rather than baked into the bundle.
|
||
|
|
# Right now that is the origin of the theme service; an empty value leaves the
|
||
|
|
# application on its own styling.
|
||
|
|
set -eu
|
||
|
|
|
||
|
|
CONFIG_DIR=/usr/share/nginx/html
|
||
|
|
CONFIG_FILE="$CONFIG_DIR/runtime-config.js"
|
||
|
|
|
||
|
|
# nginx serves its own error pages from this directory, so a read-only filesystem
|
||
|
|
# would otherwise turn a missing file into a 500. The default is already in the
|
||
|
|
# image, so this only replaces it.
|
||
|
|
cat > "$CONFIG_FILE" <<CONFIG
|
||
|
|
window.__GO_GUESS_CONFIG__ = { themeBaseUrl: "${THEME_BASE_URL:-}" }
|
||
|
|
CONFIG
|
||
|
|
|
||
|
|
exec "$@"
|