Skip to content

Support ${VAR} environment variable interpolation in JSON config files#1430

Open
mcwalrus wants to merge 1 commit into
simonw:mainfrom
mcwalrus:feat/env-var-interpolation
Open

Support ${VAR} environment variable interpolation in JSON config files#1430
mcwalrus wants to merge 1 commit into
simonw:mainfrom
mcwalrus:feat/env-var-interpolation

Conversation

@mcwalrus
Copy link
Copy Markdown

@mcwalrus mcwalrus commented May 3, 2026

Closes #1429

Summary

Adds ${VAR} environment variable config interpolations.

  • Resolves ${VAR} from os.environ at load time.
  • Warns to stderr and leaves the placeholder unchanged if the variable is undefined.
  • Non-string values, nested structures, and lists are all handled correctly.
  • Applies to keys.json, aliases.json, and model_options.json.
  • Existing configs without ${} are unaffected.

Test Coverage

13 tests covering:

  • Basic ${VAR} resolution
  • Undefined variables (warning + passthrough)
  • Multiple variables in one string
  • Plain $VAR (no braces) left unchanged
  • Nested dict/list recursion
  • Mixed types

@mcwalrus mcwalrus force-pushed the feat/env-var-interpolation branch from 9c5bf96 to 4232e23 Compare May 3, 2026 00:21
@mcwalrus mcwalrus force-pushed the feat/env-var-interpolation branch from 4232e23 to ad19471 Compare May 3, 2026 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support ${VAR} environment variable interpolation in JSON config files

1 participant