INNER CODE UNIT · Rust

process_config

rustic-rs/rustic · src/commands.rs:226

    fn process_config(&self, _config: RusticConfig) -> Result<RusticConfig, FrameworkError> {
        // Note: The config that is "not read" is then read here in `process_config()` by the
        // rustic logic and merged with the CLI options.
        // That's why it says `_config`, because it's not read at all and therefore not needed.
        let mut config = self.config.clone();

        // Completion generation only needs the command definition. In particular, it must not
        // try to read a profile which may be inaccessible to the user generating completions.
        if matches!(self.commands, RusticCmd::Completions(_)) {
            return Ok(config);
        }

        // collect "RUSTIC_REPO_OPT*" and "OPENDAL*" env variables.
        // also add the standardized OTEL variables manually
        // since clap does not support multiple variables for a single arg
        for (var, value) in std::env::vars() {
            if let Some(var) = var.strip_prefix("RUSTIC_REPO_OPT_") {
                let var = var.from_case(Case::UpperSnake).to_case(Case::Kebab);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…