game/server/login/config/config.go

39 lines
812 B
Go
Raw Normal View History

2025-05-29 00:17:18 +08:00
package config
import (
"game/common/config"
2025-06-06 00:09:10 +08:00
"game/common/constant"
2025-05-29 00:17:18 +08:00
"github.com/fox/fox/db"
"github.com/fox/fox/log"
)
var Command *config.Command
2025-06-15 20:22:54 +08:00
var Cfg *config.Common
2025-05-29 00:17:18 +08:00
type LoginConfig struct {
}
2025-05-30 23:15:53 +08:00
func InitLog() {
2025-05-29 23:02:40 +08:00
log.Open("./log/login.log", log.DebugL)
2025-05-30 23:19:12 +08:00
log.Info("")
log.Info("")
log.Info("")
log.Info("-----init log success-----")
2025-05-29 00:17:18 +08:00
}
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)
2025-05-29 00:17:18 +08:00
if err != nil {
log.Error(err.Error())
return
}
defer func() { _ = rdb.Close() }()
2025-06-15 20:22:54 +08:00
Cfg, err = config.LoadCommonConfig(rdb, GitCommit, GitBranch, BuildDate)
2025-05-29 00:17:18 +08:00
if err != nil {
log.Error(err.Error())
return
}
log.DebugF("load common config success")
}