Expand description
Flat environment variable override helpers.
DFE services running in Kubernetes receive configuration via flat env vars
set by dfe-engine through Helm. These use single underscores as separators
(e.g., DFE_LOADER_KAFKA_BROKERS), which differs from figment’s double-underscore
convention for nested keys.
This module provides:
- Runtime helper functions for reading flat env vars with type conversion
- The
ApplyFlatEnvtrait for applying overrides to config structs - The
Normalizetrait for config normalisation after all sources merge - A generic
load_configfunction that orchestrates the full cascade
§Usage
The helper functions are designed to be called by #[derive(FlatEnvOverrides)]
generated code, but are also usable standalone:
use hyperi_rustlib::config::flat_env::*;
if let Some(host) = flat_env_string("MYAPP", "HOST") {
println!("Host override: {host}");
}Structs§
- EnvVar
Doc - Documentation for a single env var (generated by derive macro).
Traits§
- Apply
Flat Env - Trait for flat environment variable override application.
- Normalize
- Trait for config normalisation after all sources are merged.
Functions§
- flat_
env_ bool - Read a flat env var as a
bool. - flat_
env_ list - Read a flat env var as a comma-separated list.
- flat_
env_ parsed - Read a flat env var and parse via
FromStr. - flat_
env_ string - Read a flat env var
{PREFIX}_{SUFFIX}as aString. - flat_
env_ string_ sensitive - Read a flat env var as a
String, masking the value in debug output. - load_
config - Load config with full cascade: YAML -> figment env -> flat env -> normalise.