I have this code
v := viper.New()
v.SetConfigFile("settings.yaml")
v.AddConfigPath(".")
v.AddConfigPath("./settings")
v.AddConfigPath("./config")
err := v.ReadInConfig()
if err != nil {
panic(fmt.Errorf("Error when reading config: %v\n", err))
}
if as the instructions say I don't put the file extension in the
SetConfigFile it fails and says it doesn't recognize the type "". so I am
specifying the full name of the file.
If I put this in the "." directory (same directory as my go file) it works
if I put the file in the config or the settings or config directories it
doesn't work and gives me the following error
panic: Error when reading config: open settings.yaml: no such file or
directory
How do I specify a relative path to viper?
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.