envsync

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 8, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

README

Build Status codecov Go Report Card Documentation

Envsync

Description

Envsync is a tool to synchronize sample env and actual env file.

Installation

  1. Download the executable file in the given link below. Open the given link via your favorite browser. Choose envsync_linux_amd64 for linux or envsync_darwin_amd64 for OSX.

    https://github.com/bukalapak/envsync/releases/latest
    
  2. For the next steps, please, change OS with "linux" or "darwin" (depend on what you have downloaded before).

  3. Give the executable file the permission to execute.

    chmod +x ~/Downloads/envsync_[OS]_amd64
    
  4. Move to /usr/local/bin.

    mv ~/Downloads/envsync_[OS]_amd64 /usr/local/bin/envsync
    

Usage

envsync -s <source file> -t <target file>

Source file is the sample env. If the -s flag isn't provided, envsync will use the default value which is env.sample. Target file is the actual env. If the -t flag isn't provided, envsync will use the default value which is .env.

Documentation

Index

Constants

View Source
const VERSION = "1.0.0"

VERSION is envsync version

Variables

This section is empty.

Functions

This section is empty.

Types

type EnvSyncer

type EnvSyncer interface {
	// Sync synchronizes source and target.
	// Source is the default env or the sample env.
	// Target is the actual env.
	// Both source and target are string and indicate the location of the files.
	//
	// Any values in source that aren't in target will be written to target.
	// Any values in source that are in target won't be written to target.
	Sync(source, target string) error
}

EnvSyncer describes some contracts to synchronize env.

type Syncer

type Syncer struct {
}

Syncer implements EnvSyncer.

func (*Syncer) Sync

func (s *Syncer) Sync(source, target string) error

Sync implements EnvSyncer. Sync will read the file line by line. It will read the first '=' character. All characters prior to the first '=' character is considered as the key. All characters after the first '=' character until a newline character is considered as the value.

e.g: FOO=bar. FOO is the key and bar is the value.

During the synchronization process, there may be an error. Any key-values that have been synchronized before the error occurred is kept in target. Any key-values that haven't been synchronized because of an error occurred is ignored.

Directories

Path Synopsis
app
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL