← 返回
未分类 中文

Env Config Manager

Manage environment configs with loading, switching, encryption, key rotation, validation, and team-safe secret sharing for .env, YAML, and JSON files.
管理环境配置,实现加载、切换、加密、密钥轮换、校验以及团队安全的密钥共享,支持 .env、YAML、JSON 文件。
kaiyuelv kaiyuelv 来源
未分类 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 338
下载
💾 0
安装
1
版本
#config#development#dotenv#env#latest#secrets

概述

env-config-manager - 环境配置管理器

Metadata

FieldValue
--------------
Nameenv-config-manager
Slugenv-config-manager
Version1.0.0
Homepagehttps://github.com/openclaw/env-config-manager
Categorydevelopment
Tagsenv, config, dotenv, secrets, yaml, json, encryption, variables

Description

English

A comprehensive environment configuration manager for handling .env files, YAML/JSON configs, secret encryption, and multi-environment switching. Supports key rotation, variable validation, and team-safe secret sharing.

中文

环境配置管理器,用于管理 .env 文件、YAML/JSON 配置、密钥加密和多环境切换。支持密钥轮换、变量验证和团队安全共享。

Requirements

  • Python 3.8+
  • python-dotenv >= 1.0.0
  • PyYAML >= 6.0
  • cryptography >= 41.0.0
  • click >= 8.0.0

Configuration

Environment Variables

ENV_MANAGER_KEY=your-master-encryption-key
ENV_MANAGER_ENV=development

Usage

Load and Switch Environments

from env_config_manager import EnvManager

# Load .env file
env = EnvManager.load(".env")

# Switch to production config
env.switch("production")

# Get variable with fallback
db_url = env.get("DATABASE_URL", default="sqlite:///default.db")

Encrypt Secrets

from env_config_manager import SecretVault

vault = SecretVault(key="your-master-key")
encrypted = vault.encrypt("super-secret-api-key")
# Store encrypted in .env: API_KEY=ENC(vault,encrypted_value)

decrypted = vault.decrypt(encrypted)

Validate Configuration

from env_config_manager import ConfigValidator

schema = {
    "DATABASE_URL": {"required": True, "type": "url"},
    "PORT": {"required": True, "type": "int", "min": 1024, "max": 65535},
    "DEBUG": {"required": False, "type": "bool", "default": False}
}

validator = ConfigValidator(schema)
errors = validator.validate(env)

API Reference

EnvManager

  • load(path) - Load environment from file
  • switch(env_name) - Switch to named environment
  • get(key, default=None) - Get variable value
  • set(key, value) - Set variable
  • save(path) - Save current state to file
  • diff(other_env) - Compare two environments

SecretVault

  • encrypt(plaintext) - Encrypt a secret
  • decrypt(ciphertext) - Decrypt a secret
  • rotate_key(new_key) - Re-encrypt with new key

ConfigValidator

  • validate(env) - Validate environment against schema
  • add_rule(key, rule) - Add validation rule

Examples

See examples/ directory for complete examples.

Testing

cd /root/.openclaw/workspace/skills/env-config-manager
python -m pytest tests/ -v

License

MIT License

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 20:03 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

Smart Crawler

kaiyuelv
智能爬虫工具 - 企业级数据采集与反爬虫处理 | Smart Web Crawler - Enterprise data collection with anti-detection
★ 2 📥 1,872
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 679 📥 328,287
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 195 📥 67,774