game/server/chat/config/config.go
2025-05-30 23:15:53 +08:00

35 lines
744 B
Go

package config
import (
"game/common/config"
"github.com/fox/fox/db"
"github.com/fox/fox/log"
)
var Command *config.Command
var Cfg *config.Common[ChatConfig]
type ChatConfig struct {
}
func InitLog() {
log.Open("./log/chat.log", log.DebugL)
log.Info("\n\n\ninit log success")
}
func LoadConfig(GitCommit, GitBranch, BuildDate string) {
Command = config.ParseCommand()
rdb, err := db.InitRedis(Command.RedisPassword, Command.RedisHost, Command.RedisPort, 0)
if err != nil {
log.Error(err.Error())
return
}
defer func() { _ = rdb.Close() }()
Cfg, err = config.LoadCommonConfig[ChatConfig](rdb, GitCommit, GitBranch, BuildDate)
if err != nil {
log.Error(err.Error())
return
}
log.DebugF("load common config success")
}