Initial upload of env-pro CLI tool
This commit is contained in:
232
app/README.md
Normal file
232
app/README.md
Normal file
@@ -0,0 +1,232 @@
|
||||
# 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)
|
||||
|
||||
```bash
|
||||
pip install env-pro
|
||||
```
|
||||
|
||||
### From source
|
||||
|
||||
```bash
|
||||
git clone https://7000pct.gitea.bloupla.net/7000pctAUTO/env-pro.git
|
||||
cd env-pro
|
||||
pip install -e .
|
||||
```
|
||||
|
||||
## Quick Start
|
||||
|
||||
### Initialize a project
|
||||
|
||||
```bash
|
||||
cd my-project
|
||||
env-pro init
|
||||
```
|
||||
|
||||
### Create a profile
|
||||
|
||||
```bash
|
||||
env-pro profile create staging
|
||||
env-pro profile use staging
|
||||
```
|
||||
|
||||
### Add variables
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
```bash
|
||||
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 application
|
||||
- `django` - Django Python application
|
||||
- `nodejs` - Node.js application
|
||||
- `python` - Generic Python application
|
||||
- `golang` - Go application
|
||||
- `minimal` - Minimal .env template
|
||||
|
||||
## Encryption
|
||||
|
||||
env-pro uses AES-256-GCM encryption with PBKDF2 key derivation:
|
||||
|
||||
1. Generate a key: `env-pro key generate`
|
||||
2. Encrypt values: `env-pro add SECRET value --encrypt`
|
||||
3. Key is stored securely in system keyring
|
||||
|
||||
## Schema Validation
|
||||
|
||||
Create `.env.schema.yaml` in your project root:
|
||||
|
||||
```yaml
|
||||
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:
|
||||
|
||||
```bash
|
||||
# Generate .gitignore entries
|
||||
env-pro gitignore >> .gitignore
|
||||
|
||||
# Show SOPS integration info
|
||||
env-pro sops
|
||||
```
|
||||
|
||||
## Examples
|
||||
|
||||
### Development Setup
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
```bash
|
||||
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
|
||||
|
||||
```bash
|
||||
env-pro profile diff dev prod
|
||||
```
|
||||
|
||||
## Contributing
|
||||
|
||||
1. Fork the repository
|
||||
2. Create a feature branch
|
||||
3. Make your changes
|
||||
4. Run tests: `pytest tests/ -v`
|
||||
5. Submit a pull request
|
||||
|
||||
## License
|
||||
|
||||
MIT License - see [LICENSE](LICENSE) file for details.
|
||||
Reference in New Issue
Block a user