env-sync
A Rust CLI tool and library for synchronizing an environment file with a template file while preserving local customizations and comments.
Purpose
Keep your .env
files in sync with a git-trackable .env.template
file. The tool preserves your local values, comments, and customizations while adopting the structure from the template.
Usage
# Sync .env with .env.template (default)
# Specify custom files
# Enable verbose logging
How it works
- Uses the template file as the base structure
- For each variable in the template:
- If template value is empty but local has a value, keeps the local value
- If template has no comments but local does, preserves local comments
- Writes the result back to the local file
Installation
# Using cargo
# Using cargo-binstall
License
MIT OR Apache-2.0