Skip to main content

Module config

Module config 

Source
Expand description

Config discovery, load/save, selection, and the env overlay (research Pattern 2).

Discovery: IGNITION_CLI_CONFIG (explicit path — scripts and tests) FIRST, the platform path second. macOS gotcha: directories ignores XDG_CONFIG_HOME, which is exactly why every test drives the env override.

Precedence (LOCKED): CLI flag > IGNITION_* env > profile value > default. Each env concern has exactly one home: profile selection env (IGNITION_PROFILE) is folded into --profile by the bin’s apply_env_defaults; the URL env overlay lives here (apply_env_overlay); auth env resolution lives in secret.

Re-exports§

pub use profile::AuthRef;
pub use profile::Config;
pub use profile::Profile;
pub use profile::RigConfig;
pub use profile::RigEntry;
pub use profile::UiConfig;
pub use secret::BasicEnvStore;
pub use secret::Credential;
pub use secret::EnvStore;
pub use secret::KeyringStore;
pub use secret::Secret;
pub use secret::SecretStore;
pub use secret::resolve_secret;

Modules§

profile
Config + Profile serde structs — the on-disk shape of config.toml.
secret
Secrets: the Secret newtype (type-level redaction), the SecretStore seam, and env-first resolution (research Pattern 3 — the STATE.md keyring blocker resolution).

Functions§

apply_env_overlay
Env overlay (the IGNITION_* half of the LOCKED precedence): when IGNITION_URL is set it overrides the selected profile’s URL. Profile selection env (IGNITION_PROFILE) is folded into the --profile flag by the bin; auth env resolution lives in secret — one concern per home.
config_path
Config file location: IGNITION_CLI_CONFIG env override first, the platform config dir second.
load
Load config from path. A missing file is a fresh install, NOT an error (version must work day one). Unreadable or invalid TOML is CoreError::ConfigInvalid (exit 3) naming the path. Unknown keys WARN (tracing) and are otherwise tolerated — no deny_unknown_fields, ever (Pitfall 7). Sub-second poll_interval_secs is REFUSED (exit 3, poll_interval_too_small) — the strict path.
load_for_tui
The TUI’s load entry point (08-01, TUIX-05): identical parse and lenient extraction to load, but a clamp violation confined to the NEW schema surface does NOT error — it warns carrying the same poll_interval_too_small slug/message, substitutes the default cadence, and returns Ok.
resolve_selection
Resolve which profile a command targets: flag (which already contains IGNITION_PROFILE via the bin’s env-defaults step) > config.active.
save
Persist config to path, creating parent dirs. The file is written — and re-asserted — with 0600 permissions on unix (Pitfall 3.6 prevention, verified by test).