Expand description
Environment file synchronization functionality.
This module provides functionality to synchronize local environment files with template files, preserving local values and comments while adopting the template structure.
§Sync Logic
The sync process:
- Takes the template file as the base structure
- For each variable in the template:
- If template value is empty and local has a value, use local value
- If template has no inline comment but local does, copy local comment
- If template has no preceding comments but local does, copy local comments
- Writes the result back to the local file
§Examples
use env_sync::sync::{EnvSync, EnvSyncOptions};
use std::path::PathBuf;
let options = EnvSyncOptions {
local_file: Some(PathBuf::from(".env")),
template_file: PathBuf::from(".env.template"),
};
EnvSync::sync_with_options(options).unwrap();
Structs§
- EnvSync
- Main synchronization service for environment files.
- EnvSync
Options - Configuration options for environment file synchronization.
Enums§
- EnvSync
Error - Errors that can occur during environment file synchronization.