|
|
@ -9,14 +9,19 @@ import ( |
|
|
"github.com/spf13/viper" |
|
|
"github.com/spf13/viper" |
|
|
) |
|
|
) |
|
|
|
|
|
|
|
|
var dataDirPath string |
|
|
var ( |
|
|
|
|
|
dataDirPath string |
|
|
|
|
|
DoNotSetConfigName = false |
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
// ReadInConfig loads the configuration and other needed folders for further usage
|
|
|
// ReadInConfig loads the configuration and other needed folders for further usage
|
|
|
func ReadInConfig() error { |
|
|
func ReadInConfig() error { |
|
|
viper.AutomaticEnv() |
|
|
viper.AutomaticEnv() |
|
|
viper.SetEnvPrefix("gus") |
|
|
viper.SetEnvPrefix("gus") |
|
|
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) |
|
|
viper.SetEnvKeyReplacer(strings.NewReplacer(".", "_")) |
|
|
|
|
|
if !DoNotSetConfigName { |
|
|
viper.SetConfigName("config") |
|
|
viper.SetConfigName("config") |
|
|
|
|
|
} |
|
|
viper.AddConfigPath(".") |
|
|
viper.AddConfigPath(".") |
|
|
setConfigDefaults() |
|
|
setConfigDefaults() |
|
|
err := viper.ReadInConfig() |
|
|
err := viper.ReadInConfig() |
|
|
|