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
There is a huge difference in the ideas behind both.
Viper is a kinda Swiss knife for configuration - it handles a huge variety of use cases and it is massive, and many things are magically happening.
This library is about simplicity and explicitness, so there is no magic, maybe a bit more code and fewer features, but it keeps things simple: read config from file_1, then read from file_2, then read the rest from the environment (and each next read will override previous values with non-empty read values from current source).
Another feature that I proud the most of - is environment variable documentation, i.e. the library can prompt the list of all environment variables and their descriptions into help output. After my own production experience, having env. variables silently (without having a detailed description of them somewhere) is a real headache in long-running projects. So the library follows "documentation as a code" principle and allows you to just describe env. variable once (in structure tags) and then use in to read docs and to have an up-to-date description in help.
Hope this will help you to understand the difference and know when to use each library.
I was going to use viper and then stumbled on this... Want to understand the differences to make a choice.
The text was updated successfully, but these errors were encountered: