Support --env config files with CLI override #51

Merged
weichen merged 4 commits from feature/svc-envfile into main 2026-09-30 12:00:34 +00:00
Owner

feature/svc-envfile:--env 环境配置文件

scripts/svc.sh dev --env ./.env.dev [--port 9000 ...]。dotenv 安全解析(注释/引号/export);优先级 CLI > --env 文件 > .svc.env > 系统环境变量 > 默认值;与模型播种贯通。

实测:文件地址+模型生效并播种、--port 覆盖文件端口保留文件 host、缺文件快错、.svc.env 与 --env 正确分层合并。

# feature/svc-envfile:--env 环境配置文件 scripts/svc.sh dev --env ./.env.dev [--port 9000 ...]。dotenv 安全解析(注释/引号/export);优先级 CLI > --env 文件 > .svc.env > 系统环境变量 > 默认值;与模型播种贯通。 实测:文件地址+模型生效并播种、--port 覆盖文件端口保留文件 host、缺文件快错、.svc.env 与 --env 正确分层合并。
weichen added 4 commits 2026-09-30 12:00:33 +00:00
Why: per-environment bring-up needs a persistent file for the SVC_*
knobs (model keys, addresses, tavily pool) instead of relying on shell
history or the single global .svc.env; CLI flags must still win for
one-off overrides like a different port.

Evidence: live matrix - .env.dev parsed (comments, paired quotes,
export prefix) with its address and model values applied and seeded;
--port 8831 overrode the file's port while keeping its 0.0.0.0 host;
missing file fails fast; .svc.env and --env layer correctly (overlap
keys resolve to --env, disjoint keys merge).

Impact: --env FILE / --env=FILE anywhere on the command line; dotenv
parsed safely line-by-line (valid identifiers only, never sourced);
precedence CLI > --env file > .svc.env > OS env > defaults; help and
make svc ARGS examples updated.

Refs: feature/svc-envfile task card.
Record the sync checkpoint
ci / test (pull_request) Failing after 17m24s
53fbfd7efd
weichen merged commit 55d21c2414 into main 2026-09-30 12:00:34 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: weichen/Agent-System-Dev#51