[][src]Crate load_dotenv

This is a small procedural macro to load your .env file at compile time. That way you can use std::env! to load environment variables and fail the build if a variable is missing.

All it does is call the dotenv crate.

Example

.env file:

KEY=value

Rust:

use load_dotenv::load_dotenv;

load_dotenv!();

fn main() {
    assert_eq!("value", env!("KEY"));
}

Macros

load_dotenv

Load the .env file and panic if the file is missing.

try_load_dotenv

Load the .env file but don't panic if the file is missing.