Skip to main content

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 .env directly
  • 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

# 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:

  1. Compare your plaintext file with the encrypted file
  2. Show a diff of changes (new keys and updated values)
  3. 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 - encrypt only adds new keys, use --update to modify existing values
  • Non-destructive - decrypt outputs to latest/, use pull to apply to working file
  • Validated - Checks that all values are encrypted, env paths are protected
  • Confirmed - Updates require explicit y/N confirmation

License

MIT

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dotenvx_ops-0.1.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dotenvx_ops-0.1.0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

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

Hashes for dotenvx_ops-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0cec0e200df5b65271f9bf2682d17c54ed1c90144998f2d1736fe1e5f0602b1d
MD5 aad099bb8c3d17d10f5abc4f5e9376ef
BLAKE2b-256 2db637ba779eef1670edc47d4c8aee88e3350bd8b460a4d2e84a311da8e074c6

See more details on using hashes here.

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

Hashes for dotenvx_ops-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7efdaf22486524349d1f20cdcdf1519b3b9ce8eef0b4761c3647a30058e2499f
MD5 7c697c7704440468884618d69edfd314
BLAKE2b-256 20d8f3740228768c7666ebf29efbd6591854357f39d1488697f7ef1291262981

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page