Crate easyenv[][src]

Expand description

Very simple helper functions for environment variables and environment variable-driven env_logger configuration.

Enums

EnvError

Errors with env variables.

Constants

ENV_RUST_LOG

Name of the environment variable Rust’s env logger uses

Functions

get_env_bool_optional

Get an environment variable as a bool. If not present or there is an error in parsing, return None.

get_env_bool_or_default

Get an environment variable as a bool, or fall back to the provided default. Returns the default in the event of a parse error.

get_env_bool_required

Get an environment variable as a bool. If not provided or cannot parse, return an error.

get_env_num

Get an environment variable as a number, or fall back to the provided default if not set. If the env var is present but can’t be parsed, an error is returned instead.

get_env_string_optional

Get an environment variable as an optional String.

get_env_string_or_default

Get an environment variable as a String, or fall back to the provided default.

get_env_string_required

Get an environment variable as a String, or return an error.

init_all_with_default_logging

Initialize dotenv and env logger. See init_dotenv() and init_env_logger(Option<&str>) for further details.

init_dotenv

Initialize dotenv with the default .env config file.

init_env_logger

Initialize Rust’s env logger.