Documentation ¶
Index ¶
Constants ¶
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 ¶
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.