Expand description
Config includes and file-based profiles (CFG-01, #180).
A config document may carry a top-level includes: key listing file
paths or directory globs (relative to the config file’s directory).
resolve_includes reads each, recursively resolves includes in
them, and merges the result into the base document with conflict
detection: the same scalar key set in two documents is an error
(forces the operator to be explicit), while collection keys
(listeners, routes, upstreams, …) from an include REPLACE
the base’s (an include is a full topology overlay, not a delta).
File-based profiles: when gateway.lifecycle.profiles.profiles_dir
is set, the selected profile’s patch is loaded from
<profiles_dir>/<profile>.yaml instead of an inline YAML string.
apply_profile_overlay resolves the profile (from an explicit
name or the DWARA_PROFILE env var) and merges the patch onto the
base. This is backward compatible: inline profile_overrides still
work when profiles_dir is absent.
Both operate on raw YAML text BEFORE super::parse_gateway, so
the includes: / profiles_dir directives are consumed and never
reach the strict deny_unknown_fields Gateway struct.
Functions§
- apply_
profile_ overlay - Apply the selected profile’s overlay onto the base config. The
profile is
profilewhen given, else theDWARA_PROFILEenv var. Whengateway.lifecycle.profiles.profiles_diris set, the patch is loaded from<profiles_dir>/<profile>.yaml; otherwise the inlineprofile_overridesmap is used (backward compat). The merged YAML text is returned. - preprocess
- Full preprocessing: resolve includes, then apply the profile.
- resolve_
includes - Resolve
includes:directives in a config document. Theincludes:top-level key lists file paths or directory globs (relative tobase_dir). Each is read, recursively resolved, and merged into the base. Theincludes:key is removed from the result. Returns the merged YAML text.