Replies: 1 comment
-
I think it's the result of a number of different reasons, but primarily because config types and file extensions are somewhat intertwined. I don't think that's necessarily a good thing either and it might indeed make sense to introduce enums, however as we are progressing towards Viper 2, the underlying components are being decoupled (eg. encoding layer being moved out to separate packages) and most of the config types will simply be moved out from the main repo, so I'm not sure adding an enum now is a good idea. |
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
-
Hi, Viper community!
I'm having a confusion why was string chosen over using some model to have for example proper enums for
viper.SetConfigType
? It was very confusing that it uses string instead of something likeviper.ConfigTypeDotenv
, which makes it very simple to use and search for possible values, this applies to all configuration where it can be appliedCurrently it is:
viper.SetConfigType("env")
How it could be:
viper.SetConfigType(viper.ConfigTypeDotenv)
Best regards,
Aleksandr
Beta Was this translation helpful? Give feedback.
All reactions