Skip to main content

load_config

Function load_config 

Source
pub fn load_config(
    flag: Option<&Path>,
    env: &BTreeMap<String, String>,
    read: impl Fn(&Path) -> Result<String>,
) -> Result<Config, AppError>
Expand description

Loads the configuration: chooses the file, reads it with read, and layers the environment on top. A missing default file is fine; a missing explicit one is an error.

§Errors

Returns AppError::ReadConfig if an explicitly named file can’t be read, or AppError::Config if the configuration is invalid.