fn init(
        config: &Path,
        config_ext: Vec<ConfigExt>,
    ) -> anyhow::Result<WithDir<participating::Config>> {
        // Determine the parent directory of the configuration file, if any.
        // Otherwise, we default to `/`.
        let root = config
            .parent()
            .map(|path| path.to_owned())
            .unwrap_or_else(|| "/".into());

        // The app supports running without a config file, using default values.
        let encoded_config = fs::read_to_string(&config)
            .context("could not read configuration file")
            .with_context(|| config.display().to_string())?;

        // Get the TOML table version of the config indicated from CLI args, or from a new
        // defaulted config instance if one is not provided.
        let mut config_table: Value = toml::from_str(&encoded_config)?;

        // If any command line overrides to the config values are passed, apply them.
        for item in config_ext {
            item.update_toml_table(&mut config_table)?;
        }

        // Create participating config, including any overridden values.
        let participating_config: participating::Config = config_table.try_into()?;
        logging::init_with_config(&participating_config.logging)?;

        Ok(WithDir::new(root, participating_config))
    }
/// Parses the config file for the current version of casper-node, and initializes logging.
Parses the config file for the current version of casper-node, and initializes logging.
Parses the config file for the current version of casper - node and initializes logging .
fn init(
        config: &Path,
        config_ext: Vec<ConfigExt>,
    ) -> anyhow::Result<WithDir<participating::Config>> {
        // Determine the parent directory of the configuration file, if any.
        // Otherwise, we default to `/`.
        let root = config
            .parent()
            .map(|path| path.to_owned())
            .unwrap_or_else(|| "/".into());
        // The app supports running without a config file, using default values.
        let encoded_config = fs::read_to_string(&config)
            .context("could not read configuration file")
            .with_context(|| config.display().to_string())?;
        // Get the TOML table version of the config indicated from CLI args, or from a new
        // defaulted config instance if one is not provided.
        let mut config_table: Value = toml::from_str(&encoded_config)?;
        // If any command line overrides to the config values are passed, apply them.
        for item in config_ext {
            item.update_toml_table(&mut config_table)?;
        }
        // Create participating config, including any overridden values.
        let participating_config: participating::Config = config_table.try_into()?;
        logging::init_with_config(&participating_config.logging)?;
        Ok(WithDir::new(root, participating_config))
    }
fn init ( config : & Path , config_ext : Vec < ConfigExt > , ) -> anyhow :: Result < WithDir < participating :: Config > > { // Determine the parent directory of the configuration file, if any. // Otherwise, we default to `/`. let root = config . parent ( ) . map ( | path | path . to_owned ( ) ) . unwrap_or_else ( | | " " . into ( ) ) ; // The app supports running without a config file, using default values. let encoded_config = fs :: read_to_string ( & config ) . context ( " " ) . with_context ( | | config . display ( ) . to_string ( ) ) ? ; // Get the TOML table version of the config indicated from CLI args, or from a new // defaulted config instance if one is not provided. let mut config_table : Value = toml :: from_str ( & encoded_config ) ? ; // If any command line overrides to the config values are passed, apply them. for item in config_ext { item . update_toml_table ( & mut config_table ) ? ; } // Create participating config, including any overridden values. let participating_config : participating :: Config = config_table . try_into ( ) ? ; logging :: init_with_config ( & participating_config . logging ) ? ; Ok ( WithDir :: new ( root , participating_config ) ) }
Parses the config file for the current version of casper-node, and initializes logging.
Parses the config file for the current version of casper - node and initializes logging .
config
&Path
config_ext
Vec<ConfigExt>
config
&Path
config_ext
Vec<ConfigExt>