Module sync

Module sync 

Source
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:

  1. Takes the template file as the base structure
  2. 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
  3. 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.
EnvSyncOptions
Configuration options for environment file synchronization.

Enums§

EnvSyncError
Errors that can occur during environment file synchronization.