Skip to content

Load AppConfig at runtime and wire logging into CLI & API#158

Merged
aidankhogg merged 1 commit into
dev/alphafrom
codex/integrate-appconfig-into-runtime-entry-point
Jun 29, 2026
Merged

Load AppConfig at runtime and wire logging into CLI & API#158
aidankhogg merged 1 commit into
dev/alphafrom
codex/integrate-appconfig-into-runtime-entry-point

Conversation

@aidankhogg

Copy link
Copy Markdown
Contributor

Motivation

  • Provide a single runtime configuration entrypoint so process-level settings (especially logging) can be declared in an AppConfig file or via NETENGINE_CONFIG rather than scattered env/defaults.
  • Ensure FastAPI and CLI startup paths initialize logging from the same structured config so logs are consistent across entrypoints.
  • Keep spec files focused on world topology while making runtime concerns declarative and easier to test.

Description

  • Added netengine/config/runtime.py with helpers: load_app_config, configure_logging, and load_runtime_config that use ConfigLoader.load_config(AppConfig, ...) and map AppConfig.logging to the existing LoggerFactory via a generated RuntimeLogConfig class.
  • Wired runtime loading into the CLI group by adding a --config option (envvar NETENGINE_CONFIG) which calls load_runtime_config(config_file) during CLI startup.
  • Invoked load_runtime_config() at FastAPI import time in netengine/api/app.py so the API process applies the same logging defaults.
  • Added tests in tests/test_config.py to verify a minimal runtime config file applies logging defaults and that the CLI --config option passes runtime logging settings to the logger factory.

Testing

  • Ran linter: python -m ruff check netengine/config/runtime.py netengine/api/app.py netengine/cli/main.py tests/test_config.py and it passed.
  • Ran targeted pytest: pytest -q tests/test_config.py tests/test_cli.py::test_poetry_console_script_points_to_click_group and the tests passed.
  • Ran the CLI test suite: pytest -q tests/test_cli.py and all tests passed; full test run showed 47 passed for the combined runs including the new tests.

Codex Task

@aidankhogg aidankhogg self-assigned this Jun 29, 2026
@aidankhogg aidankhogg added the enhancement New feature or request label Jun 29, 2026
@aidankhogg aidankhogg merged commit 120168e into dev/alpha Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

codex enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant