mirror of
https://github.com/Mrs4s/go-cqhttp.git
synced 2025-05-08 04:55:55 +08:00
fix env conf load.
This commit is contained in:
parent
bfea93312a
commit
449ae96c8f
@ -161,6 +161,7 @@ func Get() *Config {
|
|||||||
os.Exit(0)
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if hasEnvironmentConf {
|
||||||
// type convert tools
|
// type convert tools
|
||||||
toInt64 := func(str string) int64 {
|
toInt64 := func(str string) int64 {
|
||||||
i, _ := strconv.ParseInt(str, 10, 64)
|
i, _ := strconv.ParseInt(str, 10, 64)
|
||||||
@ -175,7 +176,9 @@ func Get() *Config {
|
|||||||
global.SetAtDefault(&config.Account.ReLogin.Delay, uint(toInt64(os.Getenv("GCQ_RELOGIN_DELAY"))), uint(0))
|
global.SetAtDefault(&config.Account.ReLogin.Delay, uint(toInt64(os.Getenv("GCQ_RELOGIN_DELAY"))), uint(0))
|
||||||
global.SetAtDefault(&config.Account.ReLogin.MaxTimes, uint(toInt64(os.Getenv("GCQ_RELOGIN_MAX_TIMES"))), uint(0))
|
global.SetAtDefault(&config.Account.ReLogin.MaxTimes, uint(toInt64(os.Getenv("GCQ_RELOGIN_MAX_TIMES"))), uint(0))
|
||||||
dbConf := &LevelDBConfig{Enable: global.EnsureBool(os.Getenv("GCQ_LEVELDB"), true)}
|
dbConf := &LevelDBConfig{Enable: global.EnsureBool(os.Getenv("GCQ_LEVELDB"), true)}
|
||||||
|
if config.Database == nil {
|
||||||
config.Database = make(map[string]yaml.Node)
|
config.Database = make(map[string]yaml.Node)
|
||||||
|
}
|
||||||
config.Database["leveldb"] = func() yaml.Node {
|
config.Database["leveldb"] = func() yaml.Node {
|
||||||
n := &yaml.Node{}
|
n := &yaml.Node{}
|
||||||
_ = n.Encode(dbConf)
|
_ = n.Encode(dbConf)
|
||||||
@ -232,6 +235,7 @@ func Get() *Config {
|
|||||||
_ = node.Encode(rwsConf)
|
_ = node.Encode(rwsConf)
|
||||||
config.Servers = append(config.Servers, map[string]yaml.Node{"ws-reverse": *node})
|
config.Servers = append(config.Servers, map[string]yaml.Node{"ws-reverse": *node})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return config
|
return config
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user