Skip to main content

Module env

Module env 

Source
Expand description

Environment-variable reading and ${VAR} / ${VAR:-default} interpolation.

A single primitive shared by every config surface that expands placeholders: the profile loader interpolates a whole YAML document against the process environment, and the services config layer drives interpolate in a multi-pass loop over a secrets→env→vars source chain. Both reuse the one regex and the one unresolved-placeholder rule defined here, so the syntax never drifts between surfaces.

Functions§

contains_placeholder
Reports whether input still contains a ${VAR} / ${VAR:-default} placeholder. Used by multi-pass resolvers to detect non-convergence.
interpolate
Replaces every ${VAR} / ${VAR:-default} occurrence in input using lookup.
read_env_optional
Reads an environment variable, treating empty as absent.