Deliver BAT-003: daemon .env loading (REQ-010, minor-change)
DaemonConfig.from_env() now best-effort loads a .env file (find_dotenv usecwd, load_dotenv override=False) so operators can manage daemon env vars via .env, with real OS env taking precedence. Add python-dotenv dependency, gitignore .env, ship .env.example, and add config tests (load / OS-env precedence / absence regression / missing-DSN guard). Verification: 78 passed, ruff clean, .env ignored + .env.example tracked, and a .env-only DaemonConfig smoke. Processed via the minor-change fast path: REQ-010 (Configuration) -> Implemented, BAT-003 (batch-lite, no design) -> release-candidate. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
# BAT-003 Implementation
|
||||
|
||||
- Status: completed
|
||||
- Batch: BAT-003
|
||||
|
||||
## Plan Summary
|
||||
- REQ-010: 데몬 기동 시 `.env` best-effort 로드(OS env 우선). minor-change batch-lite.
|
||||
|
||||
## Changed Files
|
||||
- pyproject.toml: `python-dotenv>=1.0` 의존성 추가.
|
||||
- trex_core/runtime/config.py: `_load_dotenv()`(best-effort, `override=False`, `find_dotenv(usecwd=True)`) 추가 + `from_env()` 시작부 호출.
|
||||
- .gitignore: `/.env` 추가.
|
||||
- .env.example: 키 목록 참고용 신규(추적 대상).
|
||||
- tests/runtime/test_config_dotenv.py: 로드/우선순위/부재/필수누락 4 테스트.
|
||||
|
||||
## Execution Log
|
||||
1. config 에 best-effort dotenv 로더 추가(미설치/부재 시 no-op).
|
||||
2. pyproject 의존성 + .gitignore + .env.example.
|
||||
3. 단위테스트 작성, `pip install -e .` 후 실행.
|
||||
|
||||
## Validation
|
||||
- `pytest tests/runtime/test_config_dotenv.py`: 4 passed.
|
||||
- 전체 `pytest`: **78 passed** (기존 74 + 신규 4), ruff clean.
|
||||
- gitignore: `.env` IGNORED, `.env.example` trackable.
|
||||
- 스모크: `./.env` 만으로 `DaemonConfig.from_env()` 가 dsn/total/port 로드(OS env 미export) 확인.
|
||||
|
||||
## Remaining Risks
|
||||
- 없음(저위험). dotenv 미설치/.env 부재 시 graceful no-op로 회귀 없음(AC-3 테스트).
|
||||
Reference in New Issue
Block a user