docker替换变量,只在production环境进行处理

This commit is contained in:
2025-10-13 14:53:54 +08:00
parent ba91d7ff13
commit 028cc03aeb
3 changed files with 87 additions and 80 deletions
+8 -4
View File
@@ -7,14 +7,18 @@
<title>应急就医服务中心</title>
<!-- 全局配置 -->
<script>
// 默认值(可选)
window.__APP_ENV__ = {
VITE_GLOB_API_URL: '__VITE_GLOB_API_URL__', // 占位符,Docker 替换
};
// // 默认值(可选)
// window.__APP_ENV__ = {
// VITE_GLOB_API_URL: '__VITE_GLOB_API_URL__', // 占位符,Docker 替换
// };
window._AMapSecurityConfig = {
securityJsCode: "1b3b86585c863d22db1e7f7636a9e495",
}
</script>
<!-- __APP_ENV__ 由 Vite 在构建时注入 -->
<!-- 开发环境:不注入或注入空值 -->
<!-- 生产环境:注入真实值(或占位符供 Docker 替换) -->
<!-- __INJECT_APP_ENV__ -->
</head>
<style>
html, body, #app {