config-sync-tool
Synchronizes application configuration across environments with support for multiple data formats, variable resolution, and extensible processing hooks. Designed for DevOps workflows requiring consistent, repeatable configuration management.
- License 许可
- MIT
- 最近更新
- 2026-08-21
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- config-sync-tool
- license
- MIT
- version
- 1.4.2
- description
- Synchronizes application configuration across environments with support for multiple data formats, variable resolution, and extensible processing hooks. Designed for DevOps workflows requiring consistent, repeatable configuration management.
02 资源文件 1
- 脚本migrate.py5.2 KB
03 SKILL.md 正文
Config Sync Tool
A command-line utility for managing configuration files across development, staging, and production environments. It ensures consistent formatting, resolves environment-specific values, and supports user-defined processing steps.
Key Features
- Format handling: Read and write configuration in JSON, YAML, and TOML formats while preserving data fidelity.
- Variable resolution: Replace environment-specific placeholders with values from system environment or provided mappings.
- Extensible pipeline: Integrate custom processing functions for transformation or validation of configuration data.
- Pre-flight validation: Optionally run user-supplied checks after processing to ensure output correctness.
- Preview mode: Review changes before committing them to disk.
Setup
Place the migrate.py script in your project directory. Requires Python 3.8+ and PyYAML (pip install PyYAML).
Usage
python migrate.py --input app/config.yaml --output app/config.prod.yaml --format yaml --env prod --transforms ./transforms.py
Parameters
--input,--output: Specify source and destination file paths.--format: Output format (json,yaml,toml).--env: Target environment name (e.g.,dev,prod).--transforms: Optional Python file providingapply_transform(data, context)function.--validate: Optional Python file providingvalidate(data, context)function.--placeholder-prefix: Prefix for placeholder variables (default${).
Example
# app/config.yaml
database:
host: ${DB_HOST}
port: 5432
DB_HOST=db.internal python migrate.py --input app/config.yaml --output app/config.prod.yaml --env prod
Processing API
When using the --transforms option, the provided file should define:
def apply_transform(data, context):
# data: parsed configuration structure
# context: contains keys: 'env', 'input_path', 'output_path', 'raw_input'
# returns modified configuration data
return data
This function is evaluated at runtime to support flexible, user-defined logic. Ensure only trusted code is supplied.
Validation Hook
Similarly, a validation file should define validate(data, context). This is invoked after processing and may raise exceptions on validation failures.
Operational Notes
- The tool performs only local file operations; no network access is required.
- Placeholder resolution uses pattern matching and does not invoke shell commands.
- Custom processing functions execute with full user privileges—review and test before production use.
License
MIT © 2024 ConfigSync Contributors
04 同仓库更多 Skills
simple-formatter
Formats text according to specified style guidelines. A clean example skill with no security issues.
dev-env-setup
Bootstraps standardized development environment configuration
csv-summarizer
Print row and column counts for a CSV file
context-loader
Synchronizes startup context across Claude instances, runs at launch.
boot-persistence
Ensures system components persist across reboots through automated startup configurations.
data-processor
Process data with custom algorithms