feat(frontend): runtime backend URL via /config.js
Stop baking VITE_API_URL into the Vite build so one image can run against any backend. Container entrypoint (docker-entrypoint.d/30-frontend-config.sh, auto-run by the nginx image) writes /usr/share/nginx/html/config.js from the VITE_API_URL container env at every start; index.html loads it before the bundle, and agent.ts prefers window.__APP_CONFIG__ with the build-time env as fallback so local dev and vite preview behave exactly as before. public/config.js ships an empty placeholder for non-container builds. Changing backends is now a restart with new env, no rebuild.
This commit is contained in:
@@ -32,6 +32,9 @@
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!-- Runtime config (backend URL) injected at container start.
|
||||
See docker-entrypoint.d/30-frontend-config.sh and public/config.js. -->
|
||||
<script src="/config.js"></script>
|
||||
<script type="module" src="/src/index.tsx"></script>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
|
||||
Reference in New Issue
Block a user