Commit 2df79799 authored by Jan Reimes's avatar Jan Reimes
Browse files

🐛 fix(config): interpolate env vars after TOML parse instead of in raw string

Previously env var interpolation ran on the raw TOML string before
parsing, which could corrupt TOML syntax.  Now interpolate on the
parsed dict so only string values are substituted.
parent 154c3cd7
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -167,12 +167,10 @@ def load_config_file(config_file: Path) -> dict[str, Any]:

    try:
        if suffix == ".toml":
            # For TOML, we need to interpolate BEFORE parsing since TOML
            # doesn't support ${VAR} syntax natively
            with config_file.open("r", encoding="utf-8") as f:
                content = f.read()
            content = _interpolate_env_vars(content)
            data = tomllib.loads(content)
            data = _interpolate_env_vars(data)
        elif suffix in {".yaml", ".yml"}:
            yaml = import_module("yaml")