#env-file #env #dotenv #environment #compile-time #settings #proc-macro

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

#53 in #dotenv

Download history 58/week @ 2024-01-19 44/week @ 2024-01-26 28/week @ 2024-02-02 55/week @ 2024-02-09 100/week @ 2024-02-16 82/week @ 2024-02-23 88/week @ 2024-03-01 159/week @ 2024-03-08 85/week @ 2024-03-15 95/week @ 2024-03-22 153/week @ 2024-03-29 72/week @ 2024-04-05 79/week @ 2024-04-12 82/week @ 2024-04-19 84/week @ 2024-04-26 109/week @ 2024-05-03

365 downloads per month

MIT license

4KB

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