Skip to main content

Crate dotenvpp

Crate dotenvpp 

Source
Expand description

§DotenvPP

From-scratch .env parsing, interpolation, and layered loading for Rust.

§Quick Start

dotenvpp::load().ok();
let db_url = dotenvpp::var("DATABASE_URL").unwrap();

§API Overview

FunctionDescription
load()Load layered .env files from cwd without overriding existing vars
load_override()Load layered .env files overriding existing vars
load_with_env()Load layered files for a named environment
from_layered_env()Preview layered config without mutating the process env
from_path()Load and resolve a specific file
from_read()Parse and resolve from any impl Read
var()Get a single env var
vars()Iterate all env vars
vars_os()Iterate env vars without Unicode conversion

Structs§

EnvPair
A parsed key-value pair from a .env file.
InterpolationError
Interpolation failures for ${VAR} style expansions.

Enums§

Error
Errors that can occur when loading .env files.
InterpolationErrorKind
Specific interpolation failure kinds.
ParseError
Errors that can occur while parsing .env content.

Functions§

from_layered_env
Resolve layered .env files from the current directory without mutating the process environment.
from_path
Load environment variables from a specific file path.
from_path_iter
Resolve a .env file and return an iterator over the final key/value pairs without setting them in the environment.
from_path_override
Load environment variables from a specific file path and override existing process variables.
from_read
Parse .env content from any reader without setting env vars.
load
Load layered environment files from the current directory.
load_override
Load layered environment files from the current directory and override existing process variables.
load_with_env
Load layered environment files for a specific environment name.
load_with_env_override
Load layered environment files for a specific environment name and override existing process variables.
var
Get a single environment variable’s value.
vars
Returns an iterator over all environment variables as (String, String) pairs.
vars_os
Returns an iterator over all environment variables as (OsString, OsString) pairs.
version
Returns the crate version.

Type Aliases§

Result
Convenience type alias.