CLI tool for syncing encrypted .env files across teams using dotenvx
This project has been archived.
The maintainers of this project have marked this project as archived. No new releases are expected.
Project description
dotenvx-ops
CLI tool for syncing encrypted .env files across teams using dotenvx.
Why dotenvx-ops?
dotenvx is a great tool for encrypting .env files. It's designed to run apps with encrypted env files directly (dotenvx run), but sometimes you need plaintext .env files:
- Your framework reads
.envdirectly - You want to keep existing workflows
- You need to inspect values during debugging
The problem with plaintext workflows
When decrypting .env files manually, operational risks emerge:
- Path mistakes - Typing paths manually every time leads to errors
- OS differences - Path separators and behaviors vary across systems
- Multi-environment chaos - Managing dev/staging/production separately is tedious
- Accidental commits - Easy to forget gitignore and leak secrets
How dotenvx-ops helps
| Problem | Solution |
|---|---|
| Path mistakes | Config file manages all paths centrally |
| OS differences | Consistent interface across platforms |
| Multi-environment | Just specify env name: dotenvx-ops encrypt development |
| Accidental commits | Auto-configures gitignore, validates env paths are protected |
| Overwriting team values | Append-only encryption preserves existing keys |
| Losing local changes | Non-destructive decrypt outputs to latest/, not your working file |
| Over-sharing keys | Separate key files per environment |
Prerequisites
- Python 3.11+
- dotenvx:
# npm
npm install -g @dotenvx/dotenvx
# brew
brew install dotenvx/brew/dotenvx
# curl
curl -sfS https://dotenvx.sh | sh
Installation
pip install dotenvx-ops
Quick Start
# 1. Initialize in your project
cd your-project
dotenvx-ops init
# 2. Create your plaintext env file
echo "API_KEY=secret123" > envs/.env.development
# 3. Encrypt it
dotenvx-ops encrypt development
# → Creates enc/.env.development.enc and envs/keys/development.keys
# 4. Share envs/keys/development.keys with your team securely
# 5. Commit the encrypted file
git add enc/.env.development.enc
git commit -m "Add encrypted development env"
Directory Structure
After dotenvx-ops init:
your-project/
├── dotenvx-ops.json # Configuration
├── enc/ # Encrypted files (commit these)
│ └── .env.development.enc
├── envs/ # Local files (gitignored)
│ ├── .env.development # Plaintext source
│ ├── .env.staging
│ ├── .env.production
│ ├── keys/ # Key files
│ │ └── development.keys
│ └── latest/ # Decrypted output
│ └── .env.development
└── .gitignore # Updated automatically
Usage
Encrypt
Add or update keys in your plaintext file, then encrypt:
dotenvx-ops encrypt development
- First run: generates key file and
.enc - Subsequent runs: adds new keys to existing
.enc(doesn't overwrite existing values)
Update existing values
To update values that already exist in the encrypted file:
dotenvx-ops encrypt development --update
This will:
- Compare your plaintext file with the encrypted file
- Show a diff of changes (new keys and updated values)
- Ask for confirmation before applying
=== Changes to be applied ===
[NEW]
+ NEW_API_KEY
[UPDATE]
~ DATABASE_URL
~ SECRET_KEY
Apply these changes? [y/N]:
Decrypt
Decrypt to latest/ directory (safe, doesn't overwrite your working file):
dotenvx-ops decrypt development
# → Output: envs/latest/.env.development
Pull
Decrypt and apply directly to your working file in one step:
dotenvx-ops pull development
# → Decrypts and copies to envs/.env.development
Configuration
Edit dotenvx-ops.json:
{
"env_dir": "envs",
"envs": {
"development": "envs/.env.development",
"staging": "envs/.env.staging",
"production": "envs/.env.production"
},
"enc_dir": "enc",
"work_dir": "tmp/dotenvx-ops"
}
Or use pyproject.toml:
[tool.dotenvx-ops]
env_dir = "envs"
enc_dir = "enc"
[tool.dotenvx-ops.envs]
development = "envs/.env.development"
staging = "envs/.env.staging"
production = "envs/.env.production"
Custom paths example
{
"env_dir": "config/env",
"envs": {
"dev": "config/env/.env.dev",
"prod": "config/env/.env.prod"
}
}
Note: All env paths must be under env_dir. This is enforced to ensure gitignore protection.
Design Principles
- Safe by default -
encryptonly adds new keys, use--updateto modify existing values - Non-destructive -
decryptoutputs tolatest/, usepullto apply to working file - Validated - Checks that all values are encrypted, env paths are protected
- Confirmed - Updates require explicit
y/Nconfirmation
License
MIT
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dotenvx_ops-0.1.0.tar.gz.
File metadata
- Download URL: dotenvx_ops-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0cec0e200df5b65271f9bf2682d17c54ed1c90144998f2d1736fe1e5f0602b1d
|
|
| MD5 |
aad099bb8c3d17d10f5abc4f5e9376ef
|
|
| BLAKE2b-256 |
2db637ba779eef1670edc47d4c8aee88e3350bd8b460a4d2e84a311da8e074c6
|
File details
Details for the file dotenvx_ops-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dotenvx_ops-0.1.0-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7efdaf22486524349d1f20cdcdf1519b3b9ce8eef0b4761c3647a30058e2499f
|
|
| MD5 |
7c697c7704440468884618d69edfd314
|
|
| BLAKE2b-256 |
20d8f3740228768c7666ebf29efbd6591854357f39d1488697f7ef1291262981
|