Conform to new go-config behavior; ApplyConfig not needed
This commit is contained in:
parent
f28f791fff
commit
1bc871162d
14
config.go
14
config.go
|
@ -4,17 +4,14 @@ import (
|
||||||
cfg "github.com/tendermint/go-config"
|
cfg "github.com/tendermint/go-config"
|
||||||
)
|
)
|
||||||
|
|
||||||
// XXX: go-p2p requires ApplyConfig be called
|
|
||||||
var config cfg.Config = nil
|
var config cfg.Config = nil
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
initConfigureable(dialTimeoutKey, 3)
|
initConfigureable(dialTimeoutKey, 3)
|
||||||
initConfigureable(handshakeTimeoutKey, 20)
|
initConfigureable(handshakeTimeoutKey, 20)
|
||||||
initConfigureable(maxNumPeersKey, 50)
|
initConfigureable(maxNumPeersKey, 50)
|
||||||
|
|
||||||
initConfigureable(sendRateKey, 512000) // 500KB/s
|
initConfigureable(sendRateKey, 512000) // 500KB/s
|
||||||
initConfigureable(recvRateKey, 512000) // 500KB/s
|
initConfigureable(recvRateKey, 512000) // 500KB/s
|
||||||
|
|
||||||
initConfigureable(maxPayloadSizeKey, 1024)
|
initConfigureable(maxPayloadSizeKey, 1024)
|
||||||
|
|
||||||
cfg.OnConfig(func(newConfig cfg.Config) {
|
cfg.OnConfig(func(newConfig cfg.Config) {
|
||||||
|
@ -22,19 +19,14 @@ func init() {
|
||||||
|
|
||||||
// fill in any config values that might be missing
|
// fill in any config values that might be missing
|
||||||
for key, value := range defaultConfigValues {
|
for key, value := range defaultConfigValues {
|
||||||
if !config.IsSet(key) {
|
config.SetDefault(key, value)
|
||||||
config.Set(key, value)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
c := cfg.NewMapConfig(nil)
|
|
||||||
c.Set("log_level", "debug")
|
|
||||||
cfg.ApplyConfig(c)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// default config map
|
// default config map
|
||||||
var defaultConfigValues = make(map[string]int)
|
var defaultConfigValues = make(map[string]interface{})
|
||||||
|
|
||||||
func initConfigureable(key string, value int) {
|
func initConfigureable(key string, value interface{}) {
|
||||||
defaultConfigValues[key] = value
|
defaultConfigValues[key] = value
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue