Function get_env_or_default

Source
pub fn get_env_or_default<T: FromStr>(env_var: &str, default: T) -> T
where <T as FromStr>::Err: Debug,
Expand description

Gets an environment variable or returns a default value if not found or cannot be parsed

§Arguments

  • env_var - The name of the environment variable
  • default - The default value to use if the environment variable is not found or cannot be parsed

§Returns

The parsed value of the environment variable or the default value