| Crates.io | cargo-envy-safe |
| lib.rs | cargo-envy-safe |
| version | 0.1.2 |
| created_at | 2025-07-20 03:58:20.660017+00 |
| updated_at | 2025-07-21 15:48:00.06983+00 |
| description | A secure and safe CLI to manage .env files in Rust projects |
| homepage | https://github.com/chapus/envy-safe |
| repository | https://github.com/chapus/envy-safe |
| max_upload_size | |
| id | 1760785 |
| size | 24,643 |
A secure, developer-friendly CLI to manage and validate your
.envfiles in Rust projects.
.env against .env.example.env.exampleagecargocargo install envy-safe
Or clone it and build:
git clone https://github.com/your-user/envy-safe.git
cd envy-safe
cargo build --release
.env fileenvy-safe --check
Will compare .env and .env.example and report missing keys.
envy-safe --sync
Adds missing keys from .env.example to .env with example values.
Once installed, you can use envy-safe like any built-in cargo command:
cargo envy-safe --check
cargo envy-safe --sync
cargo envy-safe --encrypt API_KEY
cargo envy-safe --decrypt API_KEY
---
### ๐ Encrypting Values
To encrypt values in your `.env` file, set your [age](https://github.com/FiloSottile/age) public key as an environment variable:
```bash
export ENVY_AGE_RECIPIENT="age1xyz..."
Then run:
envy-safe --encrypt API_KEY
You can also create a config file at:
~/.config/envy-safe/config.toml%APPDATA%\envy-safe\config.tomlrecipient = "age1xyz..."
If
ENVY_AGE_RECIPIENTis not set and no config file is found, encryption will fail with an informative message.
Given a .env.example like:
DB_HOST=localhost
DB_PORT=5432
API_KEY=your-api-key
If your .env is missing API_KEY, running --check will show:
Missing key: API_KEY
And running --sync will append the missing key to .env.
envy-safe encrypt: Encrypt sensitive variables in .envenvy-safe decrypt: Decrypt them for runtime use.env is out-of-syncPRs are welcome! Open an issue for feature requests or bugs.
MIT
If you find this project useful, please consider giving it a star ๐
Made with ๐ by Sergio