← Back to all products
$19
Environment Manager
Multi-environment configuration manager with secrets, variables, and environment promotion.
JSONMarkdownPython
📄 Product Preview
Try the interactive reader and demo tools below, or get the full product with all content unlocked.
📖 Interactive Reader (Free Preview) ⚙ Try Demo Tools 📦 Download Free Sample📁 File Structure 12 files
environment-manager/
├── LICENSE
├── README.md
├── examples/
│ ├── env.dev
│ ├── env.prod
│ └── required_vars.json
├── free-sample.zip
├── guide/
│ ├── 01_features.md
│ ├── 02_quick-start.md
│ ├── 03_cli-reference.md
│ └── 04_license.md
├── index.html
└── src/
└── env_manager.py
📖 Documentation Preview README excerpt
Environment Manager
Part of the Deploy Kit by CodeVault
Manage .env files across development, staging, and production environments. Diff, sync, validate, and audit environment configurations to prevent missing variables from breaking your deployments.
Features
- Diff environments: Compare
.envfiles across dev/staging/prod and spot missing or changed variables - Sync variables: Copy missing variables from one environment to another
- Validate configs: Check for required variables, empty values, and format issues
- Audit report: Generate a full audit of all environments as JSON or text
- Template generation: Create
.env.examplefrom your actual.env(strips values) - Support for comments and sections in
.envfiles - Detects common mistakes: trailing spaces, duplicate keys, unquoted special characters
- Python stdlib only — zero dependencies
Quick Start
# Compare two environment files
python src/env_manager.py diff --source examples/env.dev --target examples/env.prod
# Validate an env file against required variables
python src/env_manager.py validate --env examples/env.dev --required examples/required_vars.json
# Sync missing variables from dev to staging
python src/env_manager.py sync --source examples/env.dev --target examples/env.staging
# Generate .env.example template (strips secret values)
python src/env_manager.py template --env examples/env.dev --output .env.example
# Full audit report across all environments
python src/env_manager.py audit --envs examples/env.dev,examples/env.staging,examples/env.prod --format json
CLI Reference
| Command | Description |
|---|---|
diff | Compare two env files and show differences |
validate | Check env file for issues and required vars |
sync | Copy missing variables from source to target |
template | Generate .env.example from a real env file |
audit | Full audit report across multiple env files |
| Flag | Description |
|---|---|
--source | Source env file (for diff/sync) |
--target | Target env file (for diff/sync) |
--env | Env file to operate on (for validate/template) |
--envs | Comma-separated list of env files (for audit) |
--required | JSON file listing required variable names |
--output, -o | Output file path |
--format, -f | Output format: text or json |
--verbose, -v | Enable verbose logging |
License
MIT — See LICENSE file.
... continues with setup instructions, usage examples, and more.
📄 Code Sample .py preview
src/env_manager.py
#!/usr/bin/env python3
"""
Environment Manager — Deploy Kit by DataNest
Manage .env files across development, staging, and production environments.
Diff, sync, validate, audit, and generate templates from environment configs.
Why this exists:
Missing or mismatched environment variables are one of the most common
causes of deployment failures. This tool lets you compare .env files
across environments, validate them against a requirements spec, and
generate sanitized templates — all from the command line.
Usage:
python env_manager.py diff --source .env.dev --target .env.prod
python env_manager.py validate --env .env.dev --required required_vars.json
python env_manager.py sync --source .env.dev --target .env.staging
python env_manager.py template --env .env.dev --output .env.example
python env_manager.py audit --envs .env.dev,.env.staging,.env.prod --format json
License: MIT
"""
from __future__ import annotations
import argparse
import json
import logging
import re
import sys
from dataclasses import dataclass, field
from datetime import datetime, timezone
from pathlib import Path
from typing import Any
# ---------------------------------------------------------------------------
# Constants
# ---------------------------------------------------------------------------
LOG = logging.getLogger("env-manager")
# Patterns that suggest a value is a secret and should be masked in templates.
# We check the variable NAME against these patterns.
SECRET_PATTERNS: list[re.Pattern[str]] = [
re.compile(r"(password|passwd|secret|token|key|credential)", re.IGNORECASE),
]
# Common issues detected during validation
ISSUE_EMPTY_VALUE = "empty_value"
ISSUE_TRAILING_SPACE = "trailing_space"
# ... 619 more lines ...