pub fn try_load(path: impl AsRef<str>) -> anyhow::Result<Self> {
        let path = path.as_ref();
        // Use config to load the values and merge with the environment
        let mut settings = config::Config::default();
        settings
            .merge(config::File::with_name(path))
            .context(format!("Could not read in config file from {}", path))?
            // Add in settings from the environment (with a prefix of SHARD_RS_CONFIG_)
            // Eg.. `SHARD_RS_CONFIG_PORT=X ./target/shard-rs` would set the `port` key
            .merge(config::Environment::with_prefix("SHARD_RS_CONFIG").separator("__"))
            .context("could not merge in values from the environment")?;
        let config = settings
            .try_into()
            .context("loading the Configuration struct from the merged config failed")?;
        Ok(config)
    }
/// Attempts to load the config from the file, called once at startup
Attempts to load the config from the file, called once at startup
Attempts to load the config from the file called once at startup
pub fn try_load(path: impl AsRef<str>) -> anyhow::Result<Self> {
        let path = path.as_ref();
        // Use config to load the values and merge with the environment
        let mut settings = config::Config::default();
        settings
            .merge(config::File::with_name(path))
            .context(format!("Could not read in config file from {}", path))?
            // Add in settings from the environment (with a prefix of SHARD_RS_CONFIG_)
            // Eg.. `SHARD_RS_CONFIG_PORT=X ./target/shard-rs` would set the `port` key
            .merge(config::Environment::with_prefix("SHARD_RS_CONFIG").separator("__"))
            .context("could not merge in values from the environment")?;
        let config = settings
            .try_into()
            .context("loading the Configuration struct from the merged config failed")?;
        Ok(config)
    }
pub fn try_load ( path : impl AsRef < str > ) -> anyhow :: Result < Self > { let path = path . as_ref ( ) ; // Use config to load the values and merge with the environment let mut settings = config :: Config :: default ( ) ; settings . merge ( config :: File :: with_name ( path ) ) . context ( format ! ( " " path ) ) ? // Add in settings from the environment (with a prefix of SHARD_RS_CONFIG_) // Eg.. `SHARD_RS_CONFIG_PORT=X ./target/shard-rs` would set the `port` key . merge ( config :: Environment :: with_prefix ( " " ) . separator ( " " ) ) . context ( " " ) ? ; let config = settings . try_into ( ) . context ( " " ) ? ; Ok ( config ) }
Attempts to load the config from the file, called once at startup
Attempts to load the config from the file called once at startup
path
impl AsRef<str>
path
impl AsRef<str>