Skip to content

Commit cb8dec2

Browse files
committed
do not override a value that has been set by higher-priority environment source
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent a5d4a70 commit cb8dec2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cli/options.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,9 @@ func WithLoadOptions(loadOptions ...func(*loader.Options)) ProjectOptionsFn {
170170
// WithOsEnv imports environment variables from OS
171171
func WithOsEnv(o *ProjectOptions) error {
172172
for k, v := range getAsEqualsMap(os.Environ()) {
173+
if _, set := o.Environment[k]; set {
174+
continue
175+
}
173176
o.Environment[k] = v
174177
}
175178
return nil
@@ -239,6 +242,9 @@ func WithDotEnv(o *ProjectOptions) error {
239242
if _, ok := notInEnvSet[k]; ok {
240243
continue
241244
}
245+
if _, set := o.Environment[k]; set {
246+
continue
247+
}
242248
o.Environment[k] = v
243249
}
244250
return nil

0 commit comments

Comments
 (0)