Files
beacon-web/.build/docker-entrypoint.sh
n30nex 139d3ce508 feat: stage current preview on dev for dev1 evaluation
Port the qualified web preview at c41e6fa8940fba929704bc2f9a94f119fef4a4ca onto
org dev b4d498e697. Preserve upstream changes and
branch policies; keep the independent private Collector service separate.

Preview-Version: 2.2.1-n30nex.1
Preview-Revision: c41e6fa8940fba929704bc2f9a94f119fef4a4ca
2026-10-04 16:31:50 -04:00

30 lines
1012 B
Bash

#!/bin/sh
set -e
# Runtime config lives in /config.js (served no-cache), not the hashed bundle, so env changes take
# effect on any restart and reach returning visitors. Empty values fall back to the app defaults.
OUT="${BEACON_CONFIG_OUT:-/srv/config.js}"
KEYS="VITE_API_BASE VITE_WS_URL VITE_MAP_CENTER VITE_MAP_ZOOM VITE_DISABLED_TABS VITE_ENABLED_THEMES VITE_APP_NAME VITE_SKIP_SPLASH VITE_BANNER VITE_CHANGELOG_URL"
# Values are read from ENVIRON and JSON-escaped, so any character is safe.
awk -v keys="$KEYS" 'BEGIN {
for (i = 1; i < 32; i++) esc[sprintf("%c", i)] = sprintf("\\u%04x", i)
esc["\\"] = "\\\\"
esc["\""] = "\\\""
n = split(keys, k, " ")
printf "window.__BEACON_CONFIG__ = {"
for (i = 1; i <= n; i++) {
v = ENVIRON[k[i]]
s = ""
for (j = 1; j <= length(v); j++) {
c = substr(v, j, 1)
s = s ((c in esc) ? esc[c] : c)
}
printf "%s\n \"%s\": \"%s\"", (i > 1 ? "," : ""), k[i], s
}
printf "\n};\n"
}' > "$OUT.tmp"
mv "$OUT.tmp" "$OUT"
exec "$@"