gleamunison/config
Live configuration: CLI overrides beat TOML, and TOML beats environment.
The previous config module was dead code because no TOML parser existed.
This one owns one precedence rule for every process setting, using tom
for an optional file and env for the process fallback. A missing file
is normal; a malformed file or wrong value type is an operator error and
is surfaced rather than silently ignored.
Types
Values
pub fn optional_string(
config: Config,
key: String,
) -> Result(option.Option(String), String)
pub fn path() -> String
The config file selected by GLEAMUNISON_CONFIG, else the project default.
pub fn resolve_profile() -> Result(String, String)
The one profile resolver for every admission gate: CLI overrides, then TOML, then the environment, then “local”. An empty string anywhere means unset. The Erlang bind and sandbox gates call this compiled function instead of reading the environment themselves, so a TOML-set profile is visible at admission time. Resolved per call — never cached at boot — and a malformed config file surfaces as an error the gate must refuse on.
pub fn string_or(
config: Config,
key: String,
default: String,
) -> Result(String, String)