Skip to main content

Crate philiprehberger_dotenv

Crate philiprehberger_dotenv 

Source
Expand description

Fast .env file parser with variable interpolation, multi-file layering, and type-safe loading.

§Quick Start

use philiprehberger_dotenv::DotEnv;

let env = DotEnv::load().expect("failed to load .env");
let port: u16 = env.get_as("PORT").expect("invalid PORT");
let debug: bool = env.get_bool("DEBUG").expect("invalid DEBUG");

§Features

  • Parse .env files with quoted values, comments, and escape sequences
  • Variable interpolation using ${VAR_NAME} syntax
  • Multi-file layering with priority ordering
  • Type-safe accessors for common types
  • Required variable validation

Structs§

DotEnv
A loaded set of environment variables parsed from .env files.

Enums§

DotEnvError
Errors that can occur when loading or accessing environment variables.

Functions§

load
Load environment variables from a .env file in the current directory.
load_and_apply
Load environment variables from .env and set them into the process environment.