game/server/chat/config/config.go

39 lines
810 B
Go
Raw Permalink Normal View History

package config
import (
"game/common/config"
2025-06-06 00:09:10 +08:00
"game/common/constant"
"github.com/fox/fox/db"
"github.com/fox/fox/log"
)
var Command *config.Command
2025-06-16 00:50:42 +08:00
var Cfg *config.Common
type ChatConfig struct {
}
2025-05-30 23:15:53 +08:00
func InitLog() {
2025-05-29 23:02:40 +08:00
log.Open("./log/chat.log", log.DebugL)
2025-05-30 23:19:12 +08:00
log.Info("")
log.Info("")
log.Info("")
log.Info("-----init log success-----")
}
func LoadConfig(GitCommit, GitBranch, BuildDate string) {
Command = config.ParseCommand()
2025-06-06 00:09:10 +08:00
rdb, err := db.InitRedis(Command.RedisPassword, Command.RedisHost, Command.RedisPort, constant.Redis0Config)
if err != nil {
log.Error(err.Error())
return
}
defer func() { _ = rdb.Close() }()
2025-06-16 00:50:42 +08:00
Cfg, err = config.LoadCommonConfig(rdb, GitCommit, GitBranch, BuildDate)
if err != nil {
log.Error(err.Error())
return
}
log.DebugF("load common config success")
}