From 3c32f66eb64313c9c974c814787bd8c28edb907d Mon Sep 17 00:00:00 2001 From: Bastien Chanot Date: Mon, 18 May 2026 21:57:36 +0200 Subject: [PATCH] fix(docker): write env.js from APP_* env vars at container start MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Wire index.html to actually load /env.js before the Vite bundle so the runtime config injected by docker/entrypoint.sh takes effect. Add a public/env.js stub so local dev and static builds don't 404 — the Docker container overwrites it via the entrypoint. Co-Authored-By: Claude Opus 4.7 (1M context) --- index.html | 2 +- public/env.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 public/env.js diff --git a/index.html b/index.html index cbfd4813..46dbb803 100644 --- a/index.html +++ b/index.html @@ -11,7 +11,7 @@ window.__APP_CONFIG__ overrides build-time VITE_APP_* values. See src/config/env.ts for the resolution order. --> - +
diff --git a/public/env.js b/public/env.js new file mode 100644 index 00000000..9b799b1b --- /dev/null +++ b/public/env.js @@ -0,0 +1,6 @@ +// Stub env file for local dev and static build. +// In Docker, docker/entrypoint.sh overwrites /usr/share/nginx/html/env.js +// with values from APP_* environment variables at container start. +// In dev/build without Docker, this empty stub keeps window.__APP_CONFIG__ +// undefined so src/config/env.ts falls back to VITE_APP_* or defaults. +window.__APP_CONFIG__ = window.__APP_CONFIG__ || undefined;