# BAT-026: config 디렉터리 기반 설정 관리 — `--config-path`/`--env-file` + config-dir `.env` 공용화 (trex-orb-v1 정합) - Status: release-candidate - Profile: batch-lite - Source Discovery: 없음 (trex-orb-v1 설정 관리 정합 — change-req 주도) - Included REQ: REQ-048 (CHG-20260609-01), REQ-010 (CHG-20260609-01) - Excluded REQ: 없음 ## Summary - trex-orb-v1의 config 디렉터리 기반 설정 관리(`--config ` + `--config-path ` + config-dir `.env`)를 trex-core 에 이식한다. - 핵심: `resolve_config_toml(name, config_path)`(이름→`/.toml`, `.toml` 자동 부착, **슬래시 포함 값은 하위호환 명시 경로**)(REQ-048), `.env` 를 config-dir 기준 결정적 해석(`--env-file` 우선 → `/.env`)으로 변경 + `config/.env.example` + `.gitignore` `config/*` 허용목록(REQ-010). 데몬·운영자 CLI 양쪽에 `--config-path`/`--env-file` 적용. - 안전: `from_env()` 의 legacy `.env` 로드(루트 `.env` 폴백)를 유지 → config/.env 부재 시에도 기존 루트 `.env` 로 동작(완전 하위호환). config/.env 존재 시 먼저 로드돼 우선(`override=False`). ## Scope - In Scope: - `resolve_config_toml` + `DEFAULT_CONFIG_DIR` (REQ-048) - `_load_dotenv(config_path, env_file)` config-dir 결정적 해석 + legacy 폴백 (REQ-010) - 데몬 `main` argparse `--config-path`/`--env-file` + `from_config(toml_path, env_file)` - 운영자 CLI `--config-path`/`--env-file` + `_resolve_instance` 통일 - `.gitignore` `config/*` 허용목록, `config/.env.example` 신규 - Out of Scope: - 실제 `.env` → `config/.env` 물리 이동(운영 배포 절차 — 루트 `.env` 폴백으로 무중단) - TOML/env 레이어링 정책(키 우선순위) 변경 — 기존 유지 ## Documents - Planning: [planning.md](./planning.md) - Design: none (batch-lite with no architecture impact) - Implementation: [verification.md](./verification.md) 에 구현 요약 포함 (batch-lite) - Verification: [verification.md](./verification.md) ## Notes - Profile **batch-lite**: 국소 변경(config.py/daemon.py/cli.py + .gitignore + config 예제). 신규 런타임 흐름·계약 필드 없음(인자·해석 규칙 추가). `--config` 의미 확장은 인터페이스 영향이라 정식 change-req(REQ-048/010 CHG-20260609-01) 경유 → **Design Gate: no**. - REQ-048/010 은 CHG-20260609-01 로 **Approved**(신규 AC 미구현). 본 batch release-candidate + confirm-req-implemented 로 **Implemented** 복귀. - 발견 근거: 사용자 요청(trex-orb-v1 설정 관리 형태 정합).