#environment #env #dotenv #settings #config

macro load-dotenv

This is a small procedural macro to load your .env file at compile time

3 releases

0.1.2 Jan 4, 2021
0.1.1 Feb 15, 2019
0.1.0 Feb 15, 2019

#57 in Configuration

Download history 30/week @ 2021-01-21 12/week @ 2021-01-28 13/week @ 2021-02-04 37/week @ 2021-02-11 15/week @ 2021-02-18 19/week @ 2021-02-25 7/week @ 2021-03-04 27/week @ 2021-03-11 36/week @ 2021-03-18 26/week @ 2021-03-25 10/week @ 2021-04-01 18/week @ 2021-04-08 33/week @ 2021-04-15 20/week @ 2021-04-22 14/week @ 2021-04-29 8/week @ 2021-05-06

97 downloads per month

MIT license

3KB

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"));
}

License: MIT


lib.rs:

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"));
}

Dependencies

~34KB