fix(config): layer root and env compose files with expanded overrides

Load agent/cursor env overrides in config loader; pass root .env plus
environment-specific env files in env-service; align compose env_file mounts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
weichen
2026-09-13 02:55:18 +00:00
co-authored by Cursor
parent 40fdd9315c
commit fe0bb3a503
13 changed files with 203 additions and 105 deletions
+17 -14
View File
@@ -3,14 +3,12 @@
#
# 使用说明:
# 1. 复制为 .env 并填写密钥:cp .env.example .env && chmod 600 .env
# 2. 本文件供 Go 后端 (bin/server)、launch.sh 默认 compose 变量替换使用
# 3. 若通过 ./scripts/env-service.sh dev start 启容器,还需同步密钥到 configs/.env.dev
# (见 configs/.env.dev.example 第 6 节)
# 2. 本文件供 Go 后端、launch.sh 与 env-service.sh 作为公共配置源
# 3. configs/.env.<环境> 只保存端口、数据库等环境差异,且优先级高于本文件
# =============================================================================
# --- 1. 运行环境与基础目录 ---
ENV=dev
COMPOSE_PROJECT_NAME=agent-dev
DATA_DIR=./data/dev
APP_PUBLISH_HOST=127.0.0.1
HTTP_PORT=8080
@@ -42,7 +40,7 @@ PI_AGENT_RUNNER_PORT=18865
# 宿主 bin/server 直连本机 pi-agent 容器时启用;容器内 app 服务由 compose 注入 http://pi-agent:18865
# PI_AGENT_RUNNER_URL=http://127.0.0.1:18865
# Runner 服务间认证(main 必填;dev 可留空)
# RUNNER_AUTH_TOKEN=
RUNNER_AUTH_TOKEN=
# --- 7. 本机 Pi CLI 回退(不使用容器 runner 时)---
PI_AGENT_BIN=/opt/homebrew/bin/pi
@@ -54,17 +52,15 @@ PI_AGENT_MODEL=MiniMax-M2.7-highspeed
KB_DB_HOST=127.0.0.1
KB_DB_PORT=5432
KB_DB_USER=regkb
KB_DB_PASSWORD=shared_kb_secret_pass
KB_DB_PASSWORD=
KB_DB_NAME=regulations
# --- 9. 向量 Embedding / Reranker(Go 宿主 KB 检索;容器 app 当前未透传,宿主模式必填)---
# --- 9. 向量 Embedding / Reranker(Go 宿主与容器 app 的 KB 检索)---
EMBEDDING_ENDPOINT_URL=https://www.dmxapi.cn/v1/embeddings
EMBEDDING_PROVIDER=openai_compatible
EMBEDDING_MODEL=bge-m3
EMBEDDING_API_KEY=
RERANKER_ENDPOINT_URL=https://www.dmxapi.cn/v1/rerank
RERANKER_PROVIDER=openai_compatible
RERANKER_MODEL=bge-reranker-v2-m3-free
RERANKER_API_KEY=
@@ -87,8 +83,15 @@ ADMIN_PASSWORD=admin-secret-password-123
AUTH_REGISTRATION_ENABLED=true
AUTH_REQUIRE_APPROVAL=false
# --- 12. 可选:CORS / 内存降级 ---
# dev/test 未配置时 CORS 由代码填充 localhost 默认值
# CORS_ALLOWED_ORIGINS=http://localhost:5173,http://127.0.0.1:8080
# 生产必须为 false;main 启动时若 true 将拒绝加载
# ALLOW_IN_MEMORY=false
# --- 12. 安全、缓存与意图路由开关 ---
# 留空时 dev/test 由代码补 localhost;生产留空代表不允许跨 Origin
CORS_ALLOWED_ORIGINS=
# 生产强制 false;main compose 不接受覆盖
ALLOW_IN_MEMORY=false
CACHE_ENABLED=true
INTENT_V2_SHADOW=false
INTENT_V2_DECISION=false
INTENT_V2_DECISION_TIER=none
WORKFLOW_INTENTS_ENABLED=true
MULTI_INTENT_ENABLED=true
SEMANTIC_FALLBACK_ENABLED=false