Resolve a named setting, so no program names a database.
use foundation_settings::Settings;
let s = Settings::load()?; // ~/.config/imp/settings.conf
let dsn = s.resolve("corpus_source", "CORPUS_SOURCE_DB")?;
Resolution order, and it is the whole crate:
1. the environment variable the caller names, when it is set and not empty; 2. the setting of that name in the rendered file; 3. an error that names both, so a missing setting says where it could have come from rather than which line of which program failed.
Why it has no database dependency
The source of truth for a setting is the setting table in imp_control, and imp-control settings render produces the file this crate reads. The crate itself never connects to anything. A tool must start when the control database does not, and a guard that cannot resolve its own connection still has to decide the tool call in front of it — so the file is the rendering the resolver loads, the same shape as the lexicon's registry exports (ADR 0052).
The file
~/.config/imp/settings.conf, or whatever IMP_SETTINGS names. One name = value per line, # to end of line a comment. It is rendered; edit the rows with imp-control settings stipulate and render it again.