environs 1.0.0

typed environment variable resolution with fallback key chains
Documentation

environs

Typed environment variable resolution with fallback key chains and dotenv loading.

Built because every env config crate is either too magic or too verbose.

use environs::env;

let port: u16 = env!("APP_PORT", "PORT", default = 8080)?;
let db: String = env!("DATABASE_URL")?;
let debug: Option<bool> = env!("DEBUG")?;

Dotenv loading checks DOTENV_PATH or falls back to .env:

environs::load()?;

Errors include the source file and line where env!() was called.

cargo add environs