Skip to main content

Module loader

Module loader 

Source
Expand description

YAML loading and shell-style ${ENV_VAR:-default} interpolation.

Two loading modes: load_yaml_with_env interpolates the raw file text before parsing (used for system.yaml, which is never served back to clients), while load_yaml preserves placeholders verbatim (used for gateway.yaml, whose contents the Admin API serves to the Web UI โ€” resolved secrets must never appear there). Placeholders in gateway config are resolved at the point of consumption instead: plugin node config at graph-compile time via interpolate_env_json, route match rules and consumer credentials when the route table / consumer store are built.

Functionsยง

coerce_scalar ๐Ÿ”’
Types a resolved full-placeholder value the way YAML types the same unquoted scalar: booleans and finite numbers; everything else None.
interpolate_env
Replaces ${VAR} and ${VAR:-default} patterns with environment variable values.
interpolate_env_json
Recursively interpolates ${ENV_VAR:-default} patterns in every string leaf of a JSON value โ€” object values, array elements, and nested combinations โ€” leaving numbers, booleans, and null untouched.
interpolated_replacement ๐Ÿ”’
The replacement for a string leaf containing ${...}, None for everything else (the ${ fast-path guard included).
load_yaml
Loads a YAML file and deserializes into T without resolving ${ENV_VAR} placeholders โ€” they are preserved verbatim in the parsed structure.
load_yaml_with_env
Loads a YAML file, interpolates environment variables, and deserializes into T.