fix(docker): write env.js from APP_* env vars at container start
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) <noreply@anthropic.com>
This commit is contained in:
1 parent
97ab4f67d1
commit
3c32f66eb6
2 files changed
+7
-1
No files matched your search
+1
-1
@@ -11,7 +11,7 @@
|
||||
window.__APP_CONFIG__ overrides build-time VITE_APP_* values.
|
||||
See src/config/env.ts for the resolution order.
|
||||
-->
|
||||
<!-- __APP_CONFIG_PLACEHOLDER__ -->
|
||||
<script src="/env.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
||||
@@ -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;
|
||||
Reference in new issue
Block a user