diff --git a/index.html b/index.html
index 14d9c7b..9c0b251 100644
--- a/index.html
+++ b/index.html
@@ -5,6 +5,28 @@
+
+
<%- title %>
diff --git a/src/assets/config/host.config.ts b/src/assets/config/host.config.ts
index bce87d5..7c0b794 100644
--- a/src/assets/config/host.config.ts
+++ b/src/assets/config/host.config.ts
@@ -1,8 +1,10 @@
import { BaseConf } from "@/types/Basics";
/**
- * 通过 Vite 环境变量管理配置,不再依赖 window.conf / config.js
- * 环境变量定义在项目根目录的 .env.dev / .env.base / .env.ld 中
+ * 配置优先级(高 → 低):
+ * ① window.__APP_CONFIG__:运行时配置,index.html 引导脚本在应用模块加载前同步拉取
+ * /<应用>/<前端目标>/api/env-config(projman 配置管理在线维护、双写 Nacos)写入
+ * ② Vite 环境变量(构建期,定义在 .env.dev / .env.base / .env.ld 中):接口拉取失败/本地开发时兜底
*/
const env = import.meta.env;
@@ -18,6 +20,22 @@ let conf: BaseConf = {
isDebug: env.DEV,
};
+// 运行时配置覆盖:只覆盖运行时配置里实际出现的键(含 relayConf 逐键合并),未配置的键沿用构建期值
+const runtime = (window as any).__APP_CONFIG__;
+if (runtime && typeof runtime === "object") {
+ const { relayConf, ...flat } = runtime;
+ Object.keys(flat).forEach(key => {
+ if (flat[key] !== undefined && flat[key] !== null && flat[key] !== "") {
+ (conf as any)[key] = flat[key];
+ }
+ });
+ if (relayConf && typeof relayConf === "object") {
+ Object.keys(relayConf).forEach(key => {
+ if (relayConf[key]) (conf.relayConf as any)[key] = relayConf[key];
+ });
+ }
+}
+
// HTTPS 自动升级:当前页面是 https 时,将所有 http:// 配置项升级为 https://
var ishttps = "https:" == document.location.protocol ? true : false;
if (ishttps) {