/// Generates a ic.json5 in the directory `init_node.node_path` using the
/// provided configurations.
Generates a ic.json5 in the directory `init_node.node_path` using the
provided configurations.
Generates a ic . json5 in the directory ` init_node . node_path ` using the provided configurations .
fn create_node_config(
        registry_data_provider_config: DataProviderConfig,
        init_node: &InitializedNode,
        malicious_behaviour: Option<MaliciousBehaviour>,
        mut replica_config: ReplicaConfig,
    ) -> ReplicaConfig {
        let node_path = init_node.node_path.clone();
        let config_path = node_path.join("ic.json5");
        let state_manager_root = node_path.join("state_manager");
        let artifact_pool_root = node_path.join("artifact_pool");
        let crypto_root = init_node.crypto_path();
        let p2p_port = SocketAddr::from(&init_node.node_config.p2p_addr).port();
        let metrics_addr = SocketAddr::from(&init_node.node_config.prometheus_metrics[0]);
        let http_addr = SocketAddr::from(&init_node.node_config.public_api[0]);
        replica_config.transport = Some(TransportConfig {
            node_ip: SocketAddr::from(&init_node.node_config.p2p_addr)
                .ip()
                .to_string(),
            p2p_flows: vec![TransportFlowConfig {
                flow_tag: 1234,
                server_port: p2p_port,
                queue_size: 256,
            }],
        });
        replica_config.state_manager = Some(StateManagerConfig::new(state_manager_root));
        replica_config.http_handler = Some(http_handler::ExternalConfig {
            listen_addr: Some(http_addr),
            ..Default::default()
        });
        replica_config.metrics = Some(MetricsConfig {
            exporter: Exporter::Http(metrics_addr),
        });
        replica_config.artifact_pool = Some(ArtifactPoolTomlConfig::new(artifact_pool_root, None));
        replica_config.crypto = Some(CryptoConfig::new(crypto_root));
        replica_config.registry_client = Some(RegistryClientConfig {
            data_provider: Some(registry_data_provider_config),
        });
        // Here we use a placeholder for the log file for the replica and the
        // orchestrator.  As these files need to be recreated every time the
        // process starts, the corresponding paths will be set in situ with temp
        // files when spawning the command.
        let place_holder_path = PathBuf::from("/placeholder");
        let logger_config = Some(LoggerConfig {
            level: slog::Level::Info,
            format: ic_config::logger::LogFormat::Json,
            target: ic_config::logger::LogTarget::File(place_holder_path.clone()),
            debug_overrides: vec![
                "ic_consensus::consensus::batch_delivery".to_string(),
                "ic_consensus::consensus::catchup_package_maker".to_string(),
            ],
            // Ensure that all messages are logged, even when the internal async log channel
            // overflows.
            block_on_overflow: true,
            ..LoggerConfig::default()
        });
        let orchestrator_logger_config = logger_config.clone().map(|c| LoggerConfig {
            target: ic_config::logger::LogTarget::File(place_holder_path),
            ..c
        });
        replica_config.logger = logger_config;
        replica_config.orchestrator_logger = orchestrator_logger_config;
        replica_config.malicious_behaviour = malicious_behaviour;
        replica_config
    }
fn create_node_config ( registry_data_provider_config : DataProviderConfig , init_node : & InitializedNode , malicious_behaviour : Option < MaliciousBehaviour > , mut replica_config : ReplicaConfig , ) -> ReplicaConfig { let node_path = init_node . node_path . clone ( ) ; let config_path = node_path . join ( " " ) ; let state_manager_root = node_path . join ( " " ) ; let artifact_pool_root = node_path . join ( " " ) ; let crypto_root = init_node . crypto_path ( ) ; let p2p_port = SocketAddr :: from ( & init_node . node_config . p2p_addr ) . port ( ) ; let metrics_addr = SocketAddr :: from ( & init_node . node_config . prometheus_metrics [ 0 ] ) ; let http_addr = SocketAddr :: from ( & init_node . node_config . public_api [ 0 ] ) ; replica_config . transport = Some ( TransportConfig { node_ip : SocketAddr :: from ( & init_node . node_config . p2p_addr ) . ip ( ) . to_string ( ) , p2p_flows : vec ! [ TransportFlowConfig { flow_tag 1234 server_port p2p_port queue_size 256 } ] , } ) ; replica_config . state_manager = Some ( StateManagerConfig :: new ( state_manager_root ) ) ; replica_config . http_handler = Some ( http_handler :: ExternalConfig { listen_addr : Some ( http_addr ) , .. Default :: default ( ) } ) ; replica_config . metrics = Some ( MetricsConfig { exporter : Exporter :: Http ( metrics_addr ) , } ) ; replica_config . artifact_pool = Some ( ArtifactPoolTomlConfig :: new ( artifact_pool_root , None ) ) ; replica_config . crypto = Some ( CryptoConfig :: new ( crypto_root ) ) ; replica_config . registry_client = Some ( RegistryClientConfig { data_provider : Some ( registry_data_provider_config ) , } ) ; // Here we use a placeholder for the log file for the replica and the // orchestrator.  As these files need to be recreated every time the // process starts, the corresponding paths will be set in situ with temp // files when spawning the command. let place_holder_path = PathBuf :: from ( " " ) ; let logger_config = Some ( LoggerConfig { level : slog :: Level :: Info , format : ic_config :: logger :: LogFormat :: Json , target : ic_config :: logger :: LogTarget :: File ( place_holder_path . clone ( ) ) , debug_overrides : vec ! [ " " to_string ( ) " " to_string ( ) ] , // Ensure that all messages are logged, even when the internal async log channel // overflows. block_on_overflow : true , .. LoggerConfig :: default ( ) } ) ; let orchestrator_logger_config = logger_config . clone ( ) . map ( | c | LoggerConfig { target : ic_config :: logger :: LogTarget :: File ( place_holder_path ) , .. c } ) ; replica_config . logger = logger_config ; replica_config . orchestrator_logger = orchestrator_logger_config ; replica_config . malicious_behaviour = malicious_behaviour ; replica_config }
Generates a ic.json5 in the directory `init_node.node_path` using the
provided configurations.
Generates a ic . json5 in the directory ` init_node . node_path ` using the provided configurations .
registry_data_provider_config
DataProviderConfig
init_node
&InitializedNode
malicious_behaviour
Option<MaliciousBehaviour>
replica_config
ReplicaConfig