Crates.io | dotenvy |
lib.rs | dotenvy |
version | 0.15.7 |
source | src |
created_at | 2022-02-28 19:06:25.238818 |
updated_at | 2023-03-22 16:04:41.028594 |
description | A well-maintained fork of the dotenv crate |
homepage | https://github.com/allan2/dotenvy |
repository | https://github.com/allan2/dotenvy |
max_upload_size | |
id | 541107 |
size | 82,809 |
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.
dotenvy
crate - A well-maintained fork of the dotenv
crate.dotenvy_macro
crate - A macro for compile time dotenv inspection. This is a fork of dotenv_codegen
.dotenvy
CLI tool for running a command using the environment from a .env file (currently Unix only)use std::env;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
// Load environment variables from .env file.
// Fails if .env file not found, not readable or invalid.
dotenvy::dotenv()?;
for (key, value) in env::vars() {
println!("{key}: {value}");
}
Ok(())
}
The 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 dotenv!
macro
Currently: 1.56.1
We aim to support the latest 8 rustc versions - approximately 1 year. Increasing MSRV is not considered a semver-breaking change.
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.
This repo fixes:
dotenv!
(dotenv-rs/dotenv #57)It also adds:
io::Read
support via from_read
and from_read_iter
dotenv_override
], [from_filename_override
], [from_path_override
] and [from_read_override
]For a full list of changes, refer to the changelog.
Legend has it that the Lost Maintainer will return, merging changes from dotenvy
into dotenv
with such thrust that all Cargo.toml
s 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!