Open bricef opened 6 years ago
I'd like to marshall the config to a string (or to a file-like object) so that it can be written to stdout or used in some other way.
This isn't currently allowed as the Marshal functions are private.
This can be solved by using the marshalling the entire config manually. for example:
c := viper.AllSettings() bs, err := yaml.Marshal(c) if err != nil { // handle marshalling error } fmt.Print(string(bs))
I'd like to marshall the config to a string (or to a file-like object) so that it can be written to stdout or used in some other way.
This isn't currently allowed as the Marshal functions are private.