|
1 | | -# rustenv |
| 1 | +<div align="center"> |
2 | 2 |
|
3 | | -A fast, secure environment variable and secret management tool — written in Rust. |
| 3 | +<h1>rustenv</h1> |
4 | 4 |
|
5 | | -`rustenv` helps developers manage `.env` files, compare differences between environments, validate configurations, mask secrets, and securely encrypt/decrypt environment files. |
| 5 | +<p><strong>A fast, secure environment variable and secret management tool — written in Rust.</strong></p> |
6 | 6 |
|
7 | | -## Features |
8 | | - |
9 | | -- **Profile Management** — Handle `.env.development`, `.env.staging`, `.env.production` easily. |
10 | | -- **Diffing** — Compare variables between two environments with colorized output. |
11 | | -- **Validation** — Scan environment files for missing values, invalid ports, malformed emails, and invalid URLs. |
12 | | -- **Smart Masking** — Automatically hide sensitive keys (like passwords, keys, secrets, tokens). |
13 | | -- **Strong Encryption** — Encrypt and decrypt `.env` files with AES-256-GCM. |
14 | | -- **Multi-Format Export** — Export variables to Shell (`export KEY=val`), Docker Compose, or JSON. |
15 | | -- **Interactive Init** — Initialize `.env` from a template, prompting you for each value. |
16 | | - |
17 | | -## Installation |
| 7 | +[](https://crates.io/crates/rustenv) |
| 8 | +[](LICENSE) |
| 9 | +[](https://github.com/anilcan-kara/rustenv/actions) |
| 10 | +[](https://github.com/anilcan-kara/rustenv/releases) |
18 | 11 |
|
19 | | -### 1. From Source (Cargo) |
20 | 12 | ```bash |
21 | | -cargo install --git https://github.com/anilcan-kara/rustenv.git |
| 13 | +rustenv show # view .env with masked secrets |
| 14 | +rustenv diff .env .env.production # compare two env files |
| 15 | +rustenv encrypt .env # AES-256 encrypted .env.enc |
22 | 16 | ``` |
23 | 17 |
|
24 | | -### 2. Direct Binary Download |
25 | | -You can download the precompiled static binary for your platform directly from the GitHub Release assets: |
26 | | -- 💻 **Windows (x64)**: [rustenv-win32-x64.exe](https://github.com/anilcan-kara/rustenv/releases/download/v0.1.1/rustenv-win32-x64.exe) |
27 | | -- 🐧 **Linux (x64)**: [rustenv-linux-x64](https://github.com/anilcan-kara/rustenv/releases/download/v0.1.1/rustenv-linux-x64) |
28 | | -- 🐧 **Linux (ARM64)**: [rustenv-linux-arm64](https://github.com/anilcan-kara/rustenv/releases/download/v0.1.1/rustenv-linux-arm64) |
29 | | -- 🍎 **macOS (x64)**: [rustenv-darwin-x64](https://github.com/anilcan-kara/rustenv/releases/download/v0.1.1/rustenv-darwin-x64) |
30 | | -- 🍎 **macOS (ARM64)**: [rustenv-darwin-arm64](https://github.com/anilcan-kara/rustenv/releases/download/v0.1.1/rustenv-darwin-arm64) |
| 18 | +</div> |
31 | 19 |
|
32 | | -## Usage |
| 20 | +--- |
33 | 21 |
|
34 | | -### Show Variables |
| 22 | +## Why rustenv? |
35 | 23 |
|
36 | | -```bash |
37 | | -rustenv show # Shows variables (masked by default) |
38 | | -rustenv show --unmask # Shows variables unmasked |
39 | | -``` |
| 24 | +Managing `.env` files is painful. You share them over Slack, forget to update `.env.example`, commit secrets by accident, or have no idea what changed between environments. **rustenv** gives you a proper CLI for inspecting, comparing, validating, encrypting, and exporting your environment files. |
40 | 25 |
|
41 | | -### Diff Environments |
| 26 | +--- |
| 27 | + |
| 28 | +## Features |
| 29 | + |
| 30 | +- 👁️ **Show** — pretty-print any `.env` file with automatic secret masking |
| 31 | +- 🔍 **Diff** — compare two `.env` files side-by-side, see added/removed/changed keys |
| 32 | +- ✅ **Validate** — check syntax, detect empty values, find duplicates |
| 33 | +- 📤 **Export** — convert `.env` to shell, Docker, or JSON format |
| 34 | +- 🔐 **Encrypt** — AES-256 encrypt your `.env` file into a `.env.enc` |
| 35 | +- 🔓 **Decrypt** — decrypt a `.env.enc` back to plaintext |
| 36 | +- 🎭 **Secret masking** — auto-masks values for keys containing `SECRET`, `TOKEN`, `KEY`, `PASS`, `PWD` |
| 37 | + |
| 38 | +--- |
| 39 | + |
| 40 | +## Usage |
42 | 41 |
|
| 42 | +### `show` — Display an env file |
43 | 43 | ```bash |
44 | | -rustenv diff .env.staging .env.production |
| 44 | +rustenv show # reads .env in current dir |
| 45 | +rustenv show .env.production # specific file |
| 46 | +rustenv show --unmask # show real values (no masking) |
45 | 47 | ``` |
46 | 48 |
|
47 | | -### Validate Variables |
48 | | - |
49 | | -Checks for empty values, syntax rules, and common formats (`_PORT`, `_URL`, `_EMAIL`). |
| 49 | +### `diff` — Compare two env files |
| 50 | +```bash |
| 51 | +rustenv diff .env .env.production |
| 52 | +``` |
50 | 53 |
|
| 54 | +### `validate` — Check env file syntax |
51 | 55 | ```bash |
52 | 56 | rustenv validate |
53 | 57 | ``` |
54 | 58 |
|
55 | | -### Export Variables |
| 59 | +### `export` — Convert to different formats |
| 60 | +```bash |
| 61 | +rustenv export --format shell # export KEY="value" (sourceable) |
| 62 | +rustenv export --format docker # --env KEY=value flags for docker run |
| 63 | +rustenv export --format json # { "KEY": "value" } |
| 64 | +``` |
56 | 65 |
|
| 66 | +### `encrypt` / `decrypt` — AES-256 encryption |
57 | 67 | ```bash |
58 | | -rustenv export --format shell |
59 | | -rustenv export --format docker |
60 | | -rustenv export --format json |
| 68 | +rustenv encrypt .env # creates .env.enc (prompts for password) |
| 69 | +rustenv decrypt .env.enc -o .env # decrypt back |
61 | 70 | ``` |
62 | 71 |
|
63 | | -### Encrypt & Decrypt Secrets |
| 72 | +--- |
64 | 73 |
|
65 | | -Securely encrypt your `.env` file before committing to source control. |
| 74 | +## CLI Reference |
66 | 75 |
|
67 | | -```bash |
68 | | -rustenv encrypt .env |
69 | | -rustenv decrypt .env.enc |
| 76 | +``` |
| 77 | +rustenv <COMMAND> |
| 78 | +
|
| 79 | +Commands: |
| 80 | + show Display an env file with masked secrets |
| 81 | + diff Compare two env files |
| 82 | + validate Validate env file syntax and values |
| 83 | + export Export env file in various formats |
| 84 | + encrypt Encrypt a .env file with AES-256 |
| 85 | + decrypt Decrypt a .env.enc file |
| 86 | + help Print help for a command |
70 | 87 | ``` |
71 | 88 |
|
72 | | -### Merge Environments |
| 89 | +--- |
73 | 90 |
|
74 | | -```bash |
75 | | -rustenv merge .env.base .env.local -o .env |
76 | | -``` |
| 91 | +## Contributing |
77 | 92 |
|
78 | | -### Initialize from Template |
| 93 | +See [CONTRIBUTING.md](CONTRIBUTING.md). All PRs welcome. |
79 | 94 |
|
80 | | -```bash |
81 | | -rustenv init --from .env.template --output .env --interactive |
82 | | -``` |
| 95 | +--- |
83 | 96 |
|
84 | 97 | ## License |
85 | 98 |
|
86 | | -This project is licensed under the MIT License. |
| 99 | +MIT © [Anilcan Kara](https://github.com/anilcan-kara) |
0 commit comments