Open
Description
Hello. I was searching for a way to initialize the config file, but still couldn't find one.
viper.SetConfigName("config")
viper.SetConfigType("json")
viper.AddConfigPath("$HOME")
And then I tried the new SafeWriteConfig()
or any of the variety merged two weeks ago, but it didn't create new file or it will overwrite the original config file no matter what. And because of the $HOME
, I might need to write a function to be cross-platform. I just wish there could be a cleaner way.
Or we could add O_CREATE
to this line of code ?
https://github.com/spf13/viper/blob/master/viper.go#L1254
And also is it a good idea to have SafeWriteConfig()
to create a new file with the first config path and config name ?
Metadata
Assignees
Labels
No labels
Activity