Is there a way to include comments in a config file? #1104
-
Hope you're all well! I'm trying to do some config versioning so I can run config migrations when I update my program. I need to automate things so users don't need to manually add stuff, which is currently the case. The problem I'm running into is that I need to include comments in the .yaml file, indicating things like permissions and security policy for the file (it's sensitive). I don't see a way to add comments to config items, or a header at the top of the file, and performing If this isn't possible with Viper, I will create a feature request, but I'm hoping someone can correct me! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Viper does not and cannot support this feature sadly. Since Viper is an abstraction above several configuration sources, supporting comments in a generic way would require abstracting them as well which would be a lot of work with no real benefit. I'd like to also add that |
Beta Was this translation helpful? Give feedback.
Viper does not and cannot support this feature sadly. Since Viper is an abstraction above several configuration sources, supporting comments in a generic way would require abstracting them as well which would be a lot of work with no real benefit.
I'd like to also add that
WriteConfig
is not intended for "updating" config files. That feature was added as a sort of "dump" that can be used for debugging or creating a default config file.