fix(wakunode2): move node config inside app init branch (#2423)

This commit is contained in:
Aaryamann Challani 2024-02-13 15:40:45 +05:30 committed by GitHub
parent 50308eda0d
commit 0dac9f9dd4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 23 additions and 22 deletions

View File

@ -66,25 +66,6 @@ when isMainModule:
var conf = confRes.get()
# The Waku Network config (cluster-id=1)
if conf.clusterId == 1:
let twnClusterConf = ClusterConf.TheWakuNetworkConf()
if len(conf.shards) != 0:
conf.pubsubTopics = conf.shards.mapIt(twnClusterConf.pubsubTopics[it.uint16])
else:
conf.pubsubTopics = twnClusterConf.pubsubTopics
# Override configuration
conf.maxMessageSize = twnClusterConf.maxMessageSize
conf.clusterId = twnClusterConf.clusterId
conf.rlnRelay = twnClusterConf.rlnRelay
conf.rlnRelayEthContractAddress = twnClusterConf.rlnRelayEthContractAddress
conf.rlnRelayDynamic = twnClusterConf.rlnRelayDynamic
conf.rlnRelayBandwidthThreshold = twnClusterConf.rlnRelayBandwidthThreshold
conf.discv5Discovery = twnClusterConf.discv5Discovery
conf.discv5BootstrapNodes =
conf.discv5BootstrapNodes & twnClusterConf.discv5BootstrapNodes
## Logging setup
# Adhere to NO_COLOR initiative: https://no-color.org/
@ -97,15 +78,35 @@ when isMainModule:
logging.setupLogLevel(conf.logLevel)
logging.setupLogFormat(conf.logFormat, color)
info "Running nwaku node", version = app.git_version
logConfig(conf)
case conf.cmd
of generateRlnKeystore:
doRlnKeystoreGenerator(conf)
of noCommand:
# The Waku Network config (cluster-id=1)
if conf.clusterId == 1:
let twnClusterConf = ClusterConf.TheWakuNetworkConf()
if len(conf.shards) != 0:
conf.pubsubTopics = conf.shards.mapIt(twnClusterConf.pubsubTopics[it.uint16])
else:
conf.pubsubTopics = twnClusterConf.pubsubTopics
# Override configuration
conf.maxMessageSize = twnClusterConf.maxMessageSize
conf.clusterId = twnClusterConf.clusterId
conf.rlnRelay = twnClusterConf.rlnRelay
conf.rlnRelayEthContractAddress = twnClusterConf.rlnRelayEthContractAddress
conf.rlnRelayDynamic = twnClusterConf.rlnRelayDynamic
conf.rlnRelayBandwidthThreshold = twnClusterConf.rlnRelayBandwidthThreshold
conf.discv5Discovery = twnClusterConf.discv5Discovery
conf.discv5BootstrapNodes =
conf.discv5BootstrapNodes & twnClusterConf.discv5BootstrapNodes
var wakunode2 = App.init(rng, conf)
info "Running nwaku node", version = app.git_version
logConfig(conf)
##############
# Node setup #
##############