INNER CODE UNIT · Rust
Some
rustic-rs/rustic · src/config.rs:131
if let Some(path) = paths.iter().find(|path| path.exists()) {
merge_logs.push((Level::Info, format!("using config {}", path.display())));
let config_content = std::fs::read_to_string(AbsPathBuf::canonicalize(path)?)?;
let config_content = if self.global.profile_substitute_env {
subst::substitute(&config_content, &subst::Env).map_err(|e| {
abscissa_core::error::context::Context::new(
FrameworkErrorKind::ParseError,
Some(Box::new(e)),
)
})?
} else {
config_content
};
let mut config = Self::load_toml(config_content)?;
// sanity check
if config.global.profile_substitute_env && config.global.use_profiles.is_empty() {
merge_logs.push((Level::Warn, "Option `profile-substitute-env` is given without any profiles to load! Note that this option does NOT apply to the file where it is specified!".to_string()));
}