-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simple way to initialize a config file #430
Comments
Is there anyone working on this issue? 18 months passed and |
This seems to be fixed? |
Create and initialize with:
|
as for me it is strange. i want to use viper to manage all cases with config files, but i have to manually create file, why? |
Hi there, not sure if this is still an issue but here is the simple solution you were looking for:
|
Adding the call to
|
Hello. I was searching for a way to initialize the config file, but still couldn't find one.
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 ?The text was updated successfully, but these errors were encountered: