Skip to main content

Module config_resolver

Module config_resolver 

Source
Expand description

Layered TOML config resolver — reads /etc/recon/<name>.toml (system) and ~/.recon/<name>.toml (user), deep-merges them with user winning, and returns a single toml::Value. Used by src/config.rs and the gh script binding.

See docs/MANUAL.md “Configuration files” for the public model; see ~/Development/Starweb/superpowers/recon/specs/2026-05-25-layered-config-design.md for design rationale.

Structs§

LayerOpts
Resolved

Functions§

global
Return the process-wide LayerOpts, or a default if init_global was never called (test paths, REPL).
init_global
Set the process-wide LayerOpts once. Subsequent calls are silently ignored — the first call wins, matching OnceLock semantics. Returns the stored opts.
load_layered
Load both layers for name, deep-merge them (user wins), and return the effective toml::Value. Missing files at default paths are silent (returns empty table); missing files at env-var override paths are a hard error.
resolve_paths
Resolve which system+user paths actually exist for the given config name. Returns None for layers that are skipped or have no match. --*-config flags always beat env-var overrides.
system_candidates
Return the candidate paths for the system layer in priority order (first match wins). Uses real env vars; for tests, see system_candidates_with_env.
user_path
Return the user-layer path for config.toml (no existence check). Returns None when $HOME is unset.