Skip to main content

find_config

Function find_config 

Source
pub fn find_config(
    flag: Option<&Path>,
    env_var: &str,
    basename: &str,
) -> Result<PathBuf>
Expand description

Resolve the config file path through the fallback chain:

  1. flag (e.g. --config <path>) — honored verbatim, even when the file does not exist (caller’s choice).
  2. env_var value (e.g. KANADE_AGENT_CONFIG) — honored verbatim when set to a non-empty string.
  3. OS-standard location <config_dir>/<basename> — only used when the file is actually present.

Returns an error when none of the above produced a usable path; the message lists every option an operator can take to fix it.