Replies: 1 comment
-
Ok, from what I understood, pflags are saved separately in a map that has keys with addresses. And because no special lookup structure is used, viper simply does not know about these values when it tries to get parent keys.
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have golang application that uses viper and pflags and takes a lot of different flags. It binds them to certain location in viper configuration structure (in the minimal example it's
asdf
) and then loads all the values at once (for now I am fine with map[string]string, but potentially it might be also map[string]interface{}). The aim is to merge them with some other configuration and pass all the values to templating engine.However I seem to be unable to load that map because
viper.Get("asdf")
returnsnil
instead of expected map. You can find minimal example below. Am I missing some steps that needs to be done in order to get the configuration? How can I load all the configuration at once?Beta Was this translation helpful? Give feedback.
All reactions