Created
April 29, 2022 09:14
-
-
Save mehmetcemyucel/9e5ba7a1a7324beaccb0015a42a5fd21 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package config | |
| import ( | |
| "fmt" | |
| "github.com/spf13/viper" | |
| ) | |
| var readFromLocalAppYml = func(v *viper.Viper) *viper.Viper { | |
| fmt.Println("Reading application yml configuration") | |
| v.SetConfigName(defaultConfigFileName) | |
| v.SetTypeByDefaultValue(true) | |
| v.SetConfigType(defaultConfigFileType) | |
| v.AddConfigPath("./" + defaultConfigPath) | |
| if err := v.ReadInConfig(); err != nil { | |
| fmt.Printf("Viper read config has an error; %e\n", err) | |
| } | |
| return v | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment