Crate dotenv_plus

Source
Expand description

§Dotenv+

A dotenv solution for Rust.

§Quick Start

Write the environment variables in the env files and access them later using the var function:

KEY=value
use dotenv_plus::{
    DotEnv,
    var,
};

DotEnv::new().run();

assert_eq!(var("RUST_ENV"), "production");

assert_eq!(var("KEY"), "value");
# By default, `RUST_ENV` is set to `development`
RUST_ENV=production cargo run

Structs§

DotEnv
An environment variables initializer.

Functions§

get_var
Get an environment variable.
get_vars
Get all environment variables for the current process.
set_var
Set an environment variable for the current process.
set_vars
Set multiple environment variables for the current process.
var
Get an environment variable as string, and panic if it is missing.