package config import ( "game/common/config" "game/common/constant" "github.com/fox/fox/db" "github.com/fox/fox/log" ) const ( gateAddress1 = "114.132.124.145:5100" gateAddress2 = "114.132.124.145:5101" ) var Command *config.Command var Cfg *config.Common[ClientConfig] type ClientConfig struct { Address []string `json:"address"` // 网关地址 } func initLog() { log.Open("./log/client.log", log.DebugL) } func LoadConfig(GitCommit, GitBranch, BuildDate string) { Command = config.ParseCommand() initLog() rdb, err := db.InitRedis(Command.RedisPassword, Command.RedisHost, Command.RedisPort, constant.Redis0Config) if err != nil { log.Error(err.Error()) return } defer func() { _ = rdb.Close() }() Cfg, err = config.LoadCommonConfig[ClientConfig](rdb, GitCommit, GitBranch, BuildDate) if err != nil { log.Error(err.Error()) return } Cfg.Special.Address = append(Cfg.Special.Address, gateAddress1, gateAddress2) log.DebugF("load common config success") }