Getenv.rs

🚧 We are building in public. This is presently under heavy construction.
✨ Features
- Implements a comprehensive set of environment variable getters for
various platforms, programming languages, and tools.
- Provides a wide range of varsets (variable sets), including for:
AWS, Cargo, Conda, CUDA, Docker, Git, Go, Homebrew, Java,
Locale, macOS, NEAR, Node.js, OpenSSL, POSIX, Proxy,
Python, Ruby, Rust, SSH, Windows, and XDG.
- Protects sensitive environment variables (such as API keys) by preventing
their accidental copying, logging, or other exposure, and securely wiping
them from memory when dropped.
- Treats empty environment variables the same as missing ones.
- Supports opting out of any feature using comprehensive feature flags.
- Adheres to the Rust API Guidelines in its naming conventions.
- 100% free and unencumbered public domain software.
🛠️ Prerequisites
⬇️ Installation
Installation via Cargo
cargo add getenv
Installation in Cargo.toml
(with all features enabled)
[dependencies]
getenv = "0.1"
Installation in Cargo.toml
(with only specific features enabled)
[dependencies]
getenv = { version = "0.1", default-features = false, features = ["posix"] }
👉 Examples
Importing the library
use getenv::*;
Reading environment variables
use getenv::aws::*;
println!("AWS_ACCESS_KEY_ID={:?}", aws_access_key_id());
println!("AWS_SECRET_ACCESS_KEY={:?}", aws_secret_access_key());
📚 Reference
Integrations
Crate (Feature) |
Version |
Usage |
Summary |
miette ("miette" ) |
7.5 |
 |
Enhances dogma::{IriError, UriError} |
serde ("serde" ) |
1 |
 |
Derives serde::{Serialize, Deserialize} |
|
|
|
|
👨💻 Development
git clone https://github.com/dryrust/getenv.rs.git
