Skip to content

Explicit ${env:VAR} interpolation support in ConfigLoader#159

Merged
aidankhogg merged 1 commit into
dev/alphafrom
codex/add-environment-interpolation-support
Jun 29, 2026
Merged

Explicit ${env:VAR} interpolation support in ConfigLoader#159
aidankhogg merged 1 commit into
dev/alphafrom
codex/add-environment-interpolation-support

Conversation

@aidankhogg

Copy link
Copy Markdown
Contributor

Motivation

  • Make environment-variable interpolation behavior explicit and user-friendly by supporting a documented ${env:VAR} alias while retaining OmegaConf's built-in ${oc.env:VAR} syntax.
  • Ensure interpolation is reliably available when loading/merging configs and when resolving variables programmatically.
  • Provide tests and documentation so callers know how missing variables are handled.

Description

  • Add a _get_required_env_var helper and register_env_resolver() that registers a custom OmegaConf resolver for the ${env:VAR} alias and call it at package init and before resolving configs.
  • Invoke register_env_resolver() from ConfigLoader.load_config and ConfigLoader.resolve_env_vars, and update their docstrings to document supported syntaxes (${env:VAR} and ${oc.env:VAR}) and missing-variable behavior.
  • Add tests in tests/test_config.py that verify ${env:VAR} resolution, ${oc.env:VAR} compatibility, failure on missing variables, and resolve_env_vars behavior using temporary environment variables.
  • Run automatic formatting with black on the changed files.

Testing

  • Ran pytest tests/test_config.py -q and all tests in that file passed (51 passed).
  • Ran python -m black --check netengine/config/loader.py tests/test_config.py which succeeded (files formatted where necessary).
  • Ran python -m mypy netengine --strict which reported pre-existing typing issues in unrelated files (these failures are not introduced by this change).

Codex Task

@aidankhogg aidankhogg self-assigned this Jun 29, 2026
@aidankhogg aidankhogg added bug Something isn't working enhancement New feature or request labels Jun 29, 2026
@aidankhogg aidankhogg merged commit d068bbc into dev/alpha Jun 29, 2026
@aidankhogg aidankhogg deleted the codex/add-environment-interpolation-support branch June 29, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working codex enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant