3 releases
| 0.1.2 | Jul 21, 2025 |
|---|---|
| 0.1.1 | Jul 20, 2025 |
| 0.1.0 | Jul 20, 2025 |
#1677 in Command line utilities
78 downloads per month
12KB
195 lines
envy-safe
A secure, developer-friendly CLI to manage and validate your
.envfiles in Rust projects.
✨ Features
- ✅ Validate
.envagainst.env.example - 🔄 Sync missing variables from
.env.example - 🔐 Encrypt/decrypt secrets with
age - 🧪 GitHub Action for CI validation
- 📦 Built with Rust, installable via
cargo
🚀 Installation
cargo install envy-safe
Or clone it and build:
git clone https://github.com/your-user/envy-safe.git
cd envy-safe
cargo build --release
🛠 Usage
Check your .env file
envy-safe --check
Will compare .env and .env.example and report missing keys.
Sync missing variables
envy-safe --sync
Adds missing keys from .env.example to .env with example values.
📦 As a Cargo Subcommand
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:
- Linux/macOS:
~/.config/envy-safe/config.toml - Windows:
%APPDATA%\envy-safe\config.toml
recipient = "age1xyz..."
If
ENVY_AGE_RECIPIENTis not set and no config file is found, encryption will fail with an informative message.
📋 Example
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.
🔐 Coming Soon
envy-safe encrypt: Encrypt sensitive variables in.envenvy-safe decrypt: Decrypt them for runtime use- GitHub Action: Fail CI if
.envis out-of-sync
🤝 Contributing
PRs are welcome! Open an issue for feature requests or bugs.
📄 License
MIT
⭐️ Star This Project
If you find this project useful, please consider giving it a star 🌟
Made with 💙 by Sergio
Dependencies
~1.4–4MB
~74K SLoC