package initialize import ( "confrontation-training/global" "fmt" "github.com/gohutool/log4go" "github.com/spf13/viper" ) func LoadConfig() { viper.AddConfigPath("./config") viper.SetConfigName("application") viper.SetConfigType("yaml") if err := viper.ReadInConfig(); err != nil { fmt.Printf("Fatal error resource file: %s \n\n", err.Error()) } if err := viper.Unmarshal(&global.Config); err != nil { fmt.Printf("Unable to decode into structure Config %s \n", err.Error()) } global.Log4J = log4go.LoggerManager.GetLogger("ct") log4go.LoggerManager.InitWithXML("./config/log4j.xml") }