dotenv-typed 11.2.0

Zero-dependency .env file parser, variable interpolation engine, typed environment configuration loader, and secret-redacting Debug wrapper.
Documentation
  • Coverage
  • 100%
    13 out of 13 items documented0 out of 0 items with examples
  • Size
  • Source code size: 31.3 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 338.8 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates-dev/ctares
    2 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • vshengbro

dotenv-typed

Zero-Dependency .env Parser, Typed Environment Config Loader & Redacting SecretString

Crates.io Version Docs.rs CI Status Rust 2024 License: MIT

Workspace Overview · API Docs


Overview

dotenv-typed parses .env files with interpolation and escape handling into a layered, prefix-scoped EnvConfig supporting typed scalars, durations, lists, and redacting SecretString values with zero external dependencies.

Installation

cargo add dotenv-typed

Usage

use dotenv_typed::EnvConfig;

let raw = "APP_HOST=127.0.0.1\nAPP_PORT=8080\nAPP_ENABLED=true\n";
let config = EnvConfig::from_dotenv_str(raw).unwrap().with_prefix("APP_");
assert_eq!(config.get("HOST"), Some("127.0.0.1"));
assert!(config.get_bool_or("ENABLED", false).unwrap());

Verification

cargo run -p crate-cli -- fmt --check
cargo clippy -p dotenv-typed --all-features --all-targets -- -D warnings
cargo test -p dotenv-typed --all-features

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For inquiries, please contact the author at root@devhub.vip.