pub fn expand_env_vars(s: &str) -> StringExpand description
P4 (design §5.2 “P4”, §1.8: “env substitution in values”): expand
${VAR} references in s against the process environment. Applied at
HarnessConfig::to_config_profile to the string-valued [core]
fields that plausibly vary per deployment — base_url, system_prompt,
additional_dirs, extra_headers values, and extra_body string
values (judgment call, §1.8’s “in values” wording names no exhaustive
field list; api_key_env/api_key_cmd are deliberately EXCLUDED — the
former is already an env var NAME not a value, the latter is a shell
command the shell itself expands when it runs, see the call site’s
comment).
An unset variable is left LITERAL (${VAR} stays in the output) rather
than silently substituted with an empty string — a config author sees
immediately that something didn’t resolve instead of silently getting a
blank base_url/header/etc. Only the braced ${NAME} form is
recognized — no bare $NAME, no shell-style :-default operators —
the smallest form that satisfies the obligation without inventing a
shell-expansion dialect.