You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've a scenario, where at first configuration struct is loaded from config file and then envconfig is applied to overwrite some settings from environment variables, when they exist.
One of the fields in the config struct is a slice of string. When an environment variable for this slice exists, the slice is not replaced by value from the environment variable. Instead, resulting slice contains as many items as it was in config file set to empty string followed by environment variable value.
For example:
original slice value from config file - ["foo"]
environment variable value - "bar"
slice after envconfig - ["", "bar"]
I guess the bug is in function setSliceField on line
Hi
I've a scenario, where at first configuration
struct
is loaded from config file and then envconfig is applied to overwrite some settings from environment variables, when they exist.One of the fields in the config struct is a slice of
string
. When an environment variable for this slice exists, the slice is not replaced by value from the environment variable. Instead, resulting slice contains as many items as it was in config file set to empty string followed by environment variable value.For example:
["foo"]
"bar"
["", "bar"]
I guess the bug is in function
setSliceField
on lineenvconfig/envconfig.go
Line 252 in e689cc5
There shouldn't be
value.Len()
but0
in my opinion.Best Regards
Pavel
The text was updated successfully, but these errors were encountered: