forked from coop-cloud-mirrors/godotenv
Merge pull request #8 from calavera/add_values_to_envmap
Fix issue reading file.
This commit is contained in:
commit
ead2e75027
@ -104,7 +104,9 @@ func loadFile(filename string) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for key, value := range envMap {
|
for key, value := range envMap {
|
||||||
os.Setenv(key, value)
|
if os.Getenv(key) == "" {
|
||||||
|
os.Setenv(key, value)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
@ -129,7 +131,7 @@ func readFile(filename string) (envMap map[string]string, err error) {
|
|||||||
if !isIgnoredLine(fullLine) {
|
if !isIgnoredLine(fullLine) {
|
||||||
key, value, err := parseLine(fullLine)
|
key, value, err := parseLine(fullLine)
|
||||||
|
|
||||||
if err == nil && os.Getenv(key) == "" {
|
if err == nil {
|
||||||
envMap[key] = value
|
envMap[key] = value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user