INNER CODE UNIT · Rust

merge_profile

rustic-rs/rustic · src/config.rs:118

    pub fn merge_profile(
        &mut self,
        profile: &str,
        merge_logs: &mut Vec<(Level, String)>,
        level_missing: Level,
    ) -> Result<(), FrameworkError> {
        let profile_filename = if profile.ends_with(".toml") {
            profile.to_string()
        } else {
            profile.to_string() + ".toml"
        };
        let paths = get_config_paths(&profile_filename);

        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| {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…