/// Load [Config] from the given 'config_descr' where if a section is
/// omitted, its value is taken from the given 'default'.
Load [Config] from the given 'config_descr' where if a section is
omitted, its value is taken from the given 'default'.
Load [ Config ] from the given ' config_descr ' where if a section is omitted its value is taken from the given ' default ' .
pub fn load_with_default(source: &ConfigSource, default: Config) -> Result<Self, ConfigError> {
        let cfg = source.load::<ConfigOptional>()?;
        let logger = cfg.logger.unwrap_or(default.logger);
        let orchestrator_logger = cfg.orchestrator_logger.unwrap_or_else(|| logger.clone());
        Ok(Self {
            registry_client: cfg.registry_client.unwrap_or(default.registry_client),
            transport: cfg.transport.unwrap_or(default.transport),
            state_manager: cfg.state_manager.unwrap_or(default.state_manager),
            hypervisor: cfg.hypervisor.unwrap_or(default.hypervisor),
            http_handler: HttpHandlerConfig::try_from(cfg.http_handler).map_err(|msg| {
                ConfigError::ValidationError {
                    source: source.clone(),
                    message: msg.to_string(),
                }
            })?,
            metrics: cfg.metrics.unwrap_or(default.metrics),
            artifact_pool: cfg.artifact_pool.unwrap_or(default.artifact_pool),
            consensus: cfg.consensus.unwrap_or(default.consensus),
            crypto: cfg.crypto.unwrap_or(default.crypto),
            logger,
            orchestrator_logger,
            message_routing: cfg.message_routing.unwrap_or(default.message_routing),
            malicious_behaviour: cfg
                .malicious_behaviour
                .unwrap_or(default.malicious_behaviour),
            firewall: cfg.firewall.unwrap_or(default.firewall),
            registration: cfg.registration.unwrap_or(default.registration),
            nns_registry_replicator: cfg
                .nns_registry_replicator
                .unwrap_or(default.nns_registry_replicator),
        })
    }
pub fn load_with_default ( source : & ConfigSource , default : Config ) -> Result < Self , ConfigError > { let cfg = source . load :: < ConfigOptional > ( ) ? ; let logger = cfg . logger . unwrap_or ( default . logger ) ; let orchestrator_logger = cfg . orchestrator_logger . unwrap_or_else ( | | logger . clone ( ) ) ; Ok ( Self { registry_client : cfg . registry_client . unwrap_or ( default . registry_client ) , transport : cfg . transport . unwrap_or ( default . transport ) , state_manager : cfg . state_manager . unwrap_or ( default . state_manager ) , hypervisor : cfg . hypervisor . unwrap_or ( default . hypervisor ) , http_handler : HttpHandlerConfig :: try_from ( cfg . http_handler ) . map_err ( | msg | { ConfigError :: ValidationError { source : source . clone ( ) , message : msg . to_string ( ) , } } ) ? , metrics : cfg . metrics . unwrap_or ( default . metrics ) , artifact_pool : cfg . artifact_pool . unwrap_or ( default . artifact_pool ) , consensus : cfg . consensus . unwrap_or ( default . consensus ) , crypto : cfg . crypto . unwrap_or ( default . crypto ) , logger , orchestrator_logger , message_routing : cfg . message_routing . unwrap_or ( default . message_routing ) , malicious_behaviour : cfg . malicious_behaviour . unwrap_or ( default . malicious_behaviour ) , firewall : cfg . firewall . unwrap_or ( default . firewall ) , registration : cfg . registration . unwrap_or ( default . registration ) , nns_registry_replicator : cfg . nns_registry_replicator . unwrap_or ( default . nns_registry_replicator ) , } ) }
Load [Config] from the given 'config_descr' where if a section is
omitted, its value is taken from the given 'default'.
Load [ Config ] from the given ' config_descr ' where if a section is omitted its value is taken from the given ' default ' .
source
&ConfigSource
default
Config