开发 / 生产双配置

This commit is contained in:
2026-09-19 00:52:04 +08:00
parent 1ff4dfffb9
commit de412297fb
17 changed files with 303 additions and 591 deletions
+1 -1
View File
@@ -1,7 +1,7 @@
# 2026-09-08
## 本地开发接口切换(cms-api → 127.0.0.1:9500
- 需求:把 CMS/内容接口从 `https://cms-api.websoft.top/api` 切到本地 `http://127.0.0.1:9500/api`
- 需求:把 CMS/内容接口从 `https://hjc-api.websoft.top/api` 切到本地 `http://127.0.0.1:9500/api`
- 改法:只动 `.env`,未改 `nuxt.config.ts` 默认值(保持生产配置不变)。新增 `NUXT_PUBLIC_MODULES_API_BASE=http://127.0.0.1:9500/api`NUXT_ 前缀环境变量会覆盖 `runtimeConfig.public.modulesApiBase`
- 关联:`modulesApiBase` 被 server/api 下 site/info、page/*、article/*、product/*、case/*、banner、form/submit、sitemap、domain/resolve 共用;文件/图片走另一个变量 `fileServerBase`(默认 origin(serverApiBase)=server.websoft.top),已在 .env 留注释开关。
- 顺带修复:原 `.env``NUXT_PUBLIC_TENANT_ID` / `NUXT_PUBLIC_TEMPLATE_ID` 两行有前导空格,dotenv 无法解析 → 配置一直没生效。已去除空格(tenant 10626 / template-07 将真正生效,若之前靠默认 template-01 调试需注意行为变化)。