Add values to the envMap when reading the file.

But do not override values in the global environment.
pull/8/head
David Calavera 2014-12-23 17:57:02 -08:00
parent a01a834e16
commit dc9cc93c4e
1 changed files with 4 additions and 2 deletions

View File

@ -104,7 +104,9 @@ func loadFile(filename string) (err error) {
}
for key, value := range envMap {
os.Setenv(key, value)
if os.Getenv(key) == "" {
os.Setenv(key, value)
}
}
return
@ -129,7 +131,7 @@ func readFile(filename string) (envMap map[string]string, err error) {
if !isIgnoredLine(fullLine) {
key, value, err := parseLine(fullLine)
if err == nil && os.Getenv(key) == "" {
if err == nil {
envMap[key] = value
}
}