Crate env_plus

Source
Expand description

A library which easily allows you to set ENV variables in your process through a file.

The library is extremly simple, but also customizeable and it allows you to set your own value delimiter and comment style. You can use external config files such as .dotenv too. All you have to do is specify which delimiter and comment style need to be used.

§Example

§Cargo.toml

[dependenices]
env_plus = "0.1.2"

§.env_plus

// This is a comment!
SECRET=YOUR_SECRET

§main.rs

use env_plus::EnvLoader;
 
fn main() {
    EnvLoader::new()
    .activate();

    let secret = std::env::var("SECRET").unwrap();
    assert_eq!(secret, String::from("YOUR_SECRET"));
}

For more advanced usage, please look at the documentation for each method on the EnvLoader struct. There’re plenty of examples of how to use this crate.

Structs§

EnvLoader
The entry point of the library