5.7 KiB
5.7 KiB
env-pro
Smart Environment Variable Manager CLI - Manage environment variables with multi-profile support, encryption, validation, and template generation.
Features
- Multi-profile Management: Create, switch, and manage multiple environment profiles (dev, staging, prod)
- AES-256 Encryption: Encrypt sensitive values using AES-256-GCM encryption with secure key derivation
- Schema Validation: Validate environment variables against JSON Schema or Pydantic models
- Template Generation: Generate .env files for new projects from templates with scaffolding- Profile Commands: Commands to scaffold, list, switch, and diff environment profiles
- Encrypt/Decrypt Operations: Encrypt and decrypt individual values or entire files with key management
- Interactive Editor: Interactive mode for adding/editing variables with prompts and validation
- GitOps Integration: Generate .gitignore entries and SOPS/age integration for secrets
Installation
From PyPI (recommended)
pip install env-pro
From source
git clone https://7000pct.gitea.bloupla.net/7000pctAUTO/env-pro.git
cd env-pro
pip install -e .
Quick Start
Initialize a project
cd my-project
env-pro init
Create a profile
env-pro profile create staging
env-pro profile use staging
Add variables
env-pro add DATABASE_URL postgresql://localhost:5432/db
env-pro add SECRET_KEY my-secret --encrypt
env-pro add API_KEY --interactive
List variables
env-pro list
Commands
Core Commands
| Command | Description |
|---|---|
env-pro init |
Initialize env-pro in current directory |
env-pro add KEY VALUE |
Add a new environment variable |
env-pro set KEY VALUE |
Set or update a variable |
env-pro get KEY |
Get a variable value |
env-pro list |
List all variables |
env-pro delete KEY |
Delete a variable |
Profile Commands
| Command | Description |
|---|---|
env-pro profile create NAME |
Create a new profile |
env-pro profile list |
List all profiles |
env-pro profile use NAME |
Set active profile |
env-pro profile switch NAME |
Switch to a profile |
env-pro profile delete NAME |
Delete a profile |
env-pro profile diff PROFILE1 PROFILE2 |
Compare two profiles |
Encryption Commands
| Command | Description |
|---|---|
env-pro key generate |
Generate a new encryption key |
env-pro key rotate |
Rotate the encryption key |
env-pro key show |
Show key status |
env-pro encrypt value VALUE |
Encrypt a value |
env-pro decrypt VALUE |
Decrypt a value |
Template Commands
| Command | Description |
|---|---|
env-pro template list |
List available templates |
env-pro template show NAME |
Show template details |
env-pro template apply NAME |
Apply a template |
env-pro template create NAME |
Create a custom template |
Validation Commands
| Command | Description |
|---|---|
env-pro validate |
Validate against schema |
env-pro check |
Check required variables |
Utility Commands
| Command | Description |
|---|---|
env-pro gitignore |
Generate .gitignore entries |
env-pro example |
Generate .env.example |
env-pro export |
Export variables |
env-pro sops |
Show SOPS integration info |
Configuration
Environment Variables
| Variable | Description |
|---|---|
ENV_PRO_KEY |
Override encryption key (not recommended) |
ENV_PRO_HOME |
Custom config home directory |
ENV_PRO_PROFILE |
Override active profile |
EDITOR |
Editor for interactive editing |
Configuration Files
| File | Purpose |
|---|---|
~/.config/env-pro/config.yaml |
Global configuration |
.env-profiles/{profile}/.env |
Environment variables per profile |
.env-profiles/.active |
Active profile tracking |
.env.schema.yaml |
Schema validation file |
Templates
Built-in templates:
fastapi- FastAPI Python applicationdjango- Django Python applicationnodejs- Node.js applicationpython- Generic Python applicationgolang- Go applicationminimal- Minimal .env template
Encryption
env-pro uses AES-256-GCM encryption with PBKDF2 key derivation:
- Generate a key:
env-pro key generate - Encrypt values:
env-pro add SECRET value --encrypt - Key is stored securely in system keyring
Schema Validation
Create .env.schema.yaml in your project root:
variables:
DATABASE_URL:
type: url
required: true
description: Database connection URL
DEBUG:
type: bool
default: false
API_KEY:
type: string
required: true
Then validate with env-pro validate.
GitOps Integration
For GitOps workflows with encrypted secrets:
# Generate .gitignore entries
env-pro gitignore >> .gitignore
# Show SOPS integration info
env-pro sops
Examples
Development Setup
env-pro init
env-pro profile create dev
env-pro profile use dev
env-pro add DATABASE_URL postgresql://localhost:5432/devdb
env-pro add DEBUG true
env-pro template apply fastapi --var APP_NAME=MyAPI
Production Deployment
env-pro profile create prod
env-pro profile use prod
env-pro add DATABASE_URL postgresql://prod:5432/proddb --encrypt
env-pro add API_KEY --interactive --encrypt
env-pro validate
env-pro example > .env.production.example
Profile Comparison
env-pro profile diff dev prod
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Run tests:
pytest tests/ -v - Submit a pull request
License
MIT License - see LICENSE file for details.