39 lines
812 B
Go
39 lines
812 B
Go
package config
|
|
|
|
import (
|
|
"game/common/config"
|
|
"game/common/constant"
|
|
"github.com/fox/fox/db"
|
|
"github.com/fox/fox/log"
|
|
)
|
|
|
|
var Command *config.Command
|
|
var Cfg *config.Common
|
|
|
|
type LoginConfig struct {
|
|
}
|
|
|
|
func InitLog() {
|
|
log.Open("./log/login.log", log.DebugL)
|
|
log.Info("")
|
|
log.Info("")
|
|
log.Info("")
|
|
log.Info("-----init log success-----")
|
|
}
|
|
|
|
func LoadConfig(GitCommit, GitBranch, BuildDate string) {
|
|
Command = config.ParseCommand()
|
|
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(rdb, GitCommit, GitBranch, BuildDate)
|
|
if err != nil {
|
|
log.Error(err.Error())
|
|
return
|
|
}
|
|
log.DebugF("load common config success")
|
|
}
|