Created
April 28, 2022 06:19
-
-
Save mehmetcemyucel/aae90ec62ef214775599f0205cac6675 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