|
@@ -554,17 +554,19 @@ func init() {
|
|
|
|
|
|
ErrMsgConfigFile = config["err_msg_config_file"]
|
|
|
|
|
|
- viper.SetConfigFile(ErrMsgConfigFile)
|
|
|
- err = viper.ReadInConfig()
|
|
|
- if err != nil {
|
|
|
- if _, ok := err.(viper.ConfigFileNotFoundError); ok {
|
|
|
- fmt.Println(errors.New("config file not found"))
|
|
|
- panic(any("config file not found"))
|
|
|
- } else {
|
|
|
- fmt.Println(errors.New("config file was found but another error was produced err:" + err.Error()))
|
|
|
- panic(any("config file was found but another error was produced err:" + err.Error()))
|
|
|
+ if ErrMsgConfigFile != "" {
|
|
|
+ viper.SetConfigFile(ErrMsgConfigFile)
|
|
|
+ err = viper.ReadInConfig()
|
|
|
+ if err != nil {
|
|
|
+ if _, ok := err.(viper.ConfigFileNotFoundError); ok {
|
|
|
+ fmt.Println(errors.New("config file not found"))
|
|
|
+ panic(any("config file not found"))
|
|
|
+ } else {
|
|
|
+ fmt.Println(errors.New("config file was found but another error was produced err:" + err.Error()))
|
|
|
+ panic(any("config file was found but another error was produced err:" + err.Error()))
|
|
|
+ }
|
|
|
+ return
|
|
|
}
|
|
|
- return
|
|
|
+ ViperConfig = viper.GetViper()
|
|
|
}
|
|
|
- ViperConfig = viper.GetViper()
|
|
|
}
|