pub fn from_env() -> Result<Settings, Error> {
        let mut s = Config::new();

        let defaults = Settings::default();
        s.cache = serde_json::from_value(serde_json::to_value(defaults)?)?;

        let mut env = Environment::new();
        env.separator("__".to_string());
        s.merge(env)?;

        s.try_into().map_err(Error::from)
    }
/// Load the `Settings` from the environment.
///
/// This will use the *SHOUTY_SNAKE_CASE* version of each element's name,
/// falling back to the defaults if not present.
///
/// # Examples
///
/// If you wanted to set the `port` to `1337` and `index_dir` to `/`, you
/// would use something like this:
///
/// ```text
/// $ PORT=1337 INDEX_DIR=/ cargo run
/// ```
Load the `Settings` from the environment.
This will use the *SHOUTY_SNAKE_CASE* version of each element's name,
falling back to the defaults if not present.
Load the ` Settings ` from the environment . This will use the * SHOUTY_SNAKE_CASE * version of each element ' s name falling back to the defaults if not present .
pub fn from_env() -> Result<Settings, Error> {
        let mut s = Config::new();
        let defaults = Settings::default();
        s.cache = serde_json::from_value(serde_json::to_value(defaults)?)?;
        let mut env = Environment::new();
        env.separator("__".to_string());
        s.merge(env)?;
        s.try_into().map_err(Error::from)
    }
pub fn from_env ( ) -> Result < Settings , Error > { let mut s = Config :: new ( ) ; let defaults = Settings :: default ( ) ; s . cache = serde_json :: from_value ( serde_json :: to_value ( defaults ) ? ) ? ; let mut env = Environment :: new ( ) ; env . separator ( " " . to_string ( ) ) ; s . merge ( env ) ? ; s . try_into ( ) . map_err ( Error :: from ) }
Load the `Settings` from the environment.
Load the ` Settings ` from the environment .
examples
If you wanted to set the `port` to `1337` and `index_dir` to `/`, you
would use something like this.


If you wanted to set the ` port ` to ` 1337 ` and ` index_dir ` to ` / ` you would use something like this .