game/server/login/config/config.go

36 lines
754 B
Go
Raw Normal View History

2025-05-29 00:17:18 +08:00
package config
import (
"fmt"
"game/common/config"
"github.com/fox/fox/db"
"github.com/fox/fox/log"
)
var Command *config.Command
var Cfg *config.Common[LoginConfig]
type LoginConfig struct {
}
func initLog() {
log.Open(fmt.Sprintf("login_%v.log", Command.VMod), log.DebugL)
}
func LoadConfig(GitCommit, GitBranch, BuildDate string) {
Command = config.ParseCommand()
initLog()
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[LoginConfig](rdb, GitCommit, GitBranch, BuildDate)
if err != nil {
log.Error(err.Error())
return
}
log.DebugF("load common config success")
}