A well-maintained fork of the dotenv crate.
This crate is the suggested alternative for
dotenv in security advisory RUSTSEC-2021-0141.
This library loads environment variables from a .env file. This is convenient for dev environments.
The Minimum Supported Rust Version (MSRV) is 1.58.1.
dotenvycrate - A well-maintained fork of the
dotenvy_macrocrate - A macro for compile time dotenv inspection. This is a fork of
dotenvy_codgen_implcrate - Internal implementation for dotenvy_codegen.
dotenvyCLI tool for running a command using the environment from a .env file (currently Unix only)
Loading at runtime
use dotenv; use env;
Loading at compile time
dotenv! macro provided by
dotenvy_macro crate can be used.
Warning: there is an outstanding issue with rust-analyzer (rust-analyzer #9606) related to the
Why does this fork exist?
The original dotenv crate has not been updated since June 26, 2020. Attempts to reach the authors and present maintainer were not successful (dotenv-rs/dotenv #74).
This fork intends to serve as the development home for the dotenv implementation in Rust.
What are the differences from the original?
This repo fixes:
- home directory works correctly (no longer using the deprecated
- more helpful errors for
It also adds:
- multiline support for environment variable values
- improved docs
For a full list of changes, refer to the changelog.
Legend has it that the Lost Maintainer will return, merging changes from
dotenv with such thrust that all
Cargo.tomls will lose one keystroke. Only then shall the Rust dotenv crateverse be united in true harmony.
Until then, this repo dutifully carries on the dotenv torch. It is actively maintained. Contributions and PRs are very welcome!