-
-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some environment variable are not parsed #167
Labels
Comments
Very interesting. Thanks for reporting. I also just did some testing, and setting default values for these options seem to fix the problem. That's a bit odd, but it works (see #168). I will probably merge the workaround for the top-level keys, but it would be great to have a better idea on why this is happening. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Running the following command:
The WD_AUTH and WD_PREFIX seem to be parsed correctly and the problem i experienced was that the WD_MODIFY and WD_SCOPE were not working, after doing some analysis, the problem might occur because the
Permission
is nested withinConfig
, while this works for parsing in the default way with flags and config file, it does not work with environment variables.Possible solution i tried that might work would be to use something like
v.BindEnv("field")
, looking at the tests of the library used for loading configurations, specifically this one: https://github.com/spf13/viper/blob/cc53fac037475edaec5cd2cae73e6c3cc5caef9e/viper_test.go#L967, seems to fix this nesting issue however that feature is still not shipped.And as it states in their documentation here, that with
AutomaticEnv
only loads the value when av.Get("FIELD")
is called, and they probably do not call it for the nested structures, when they get the keys it only reads the 'outside' values during unmarshaling.The text was updated successfully, but these errors were encountered: