feat(config): config 디렉터리 기반 설정 관리 (--config-path/--env-file, trex-orb-v1 정합, BAT-026)
REQ-048/010 change-req. `--config` 를 이름으로 해석 + `--config-path <dir>` (기본 ./config) + resolve_config_toml(슬래시 포함 값은 하위호환 명시 경로). `.env` 를 config-dir 결정적 해석(--env-file 우선, 없으면 <config_dir>/.env, CWD 무관) + config/.env.example + .gitignore config/* 허용목록. 운영자 CLI 도 --config-path/--env-file 동일 적용. from_env() legacy 루트 .env 폴백 유지로 완전 하위호환. 단위 23 + 전체 375 passed, ruff clean, 라이브 스모크(name·path 동일). REQ-048/010 → Implemented. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -66,7 +66,7 @@ from trex_core.application.preallocation_scheduler import DailyPreallocationSche
|
||||
from trex_core.application.snapshot_scheduler import SnapshotScheduler
|
||||
from trex_core.application.watchdog import WatchdogStore
|
||||
from trex_core.domain.slot import SlotService
|
||||
from trex_core.runtime.config import DaemonConfig
|
||||
from trex_core.runtime.config import DaemonConfig, resolve_config_toml
|
||||
|
||||
_log = logging.getLogger(__name__)
|
||||
|
||||
@@ -375,11 +375,21 @@ def main() -> None: # pragma: no cover - process entrypoint
|
||||
parser = argparse.ArgumentParser(prog="trex-core-daemon")
|
||||
parser.add_argument(
|
||||
"--config", required=True,
|
||||
help="per-instance TOML config path (instance_key, portfolio_hub_token). "
|
||||
"Required — no default (REQ-048 / dcy-009 OQ-2).",
|
||||
help="per-instance TOML name (resolved within --config-path) or explicit "
|
||||
"path. Required — no default (REQ-048 / dcy-009 OQ-2).",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--config-path", default=None,
|
||||
help="config directory (default ./config) for --config name resolution "
|
||||
"and the matching .env (REQ-048/010 CHG-20260609-01).",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--env-file", default=None,
|
||||
help="explicit .env path; overrides <config-dir>/.env (REQ-010 CHG-20260609-01).",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
config = DaemonConfig.from_config(args.config)
|
||||
toml_path = resolve_config_toml(args.config, args.config_path)
|
||||
config = DaemonConfig.from_config(toml_path, env_file=args.env_file)
|
||||
Daemon(config).run()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user