Skip to content

Commit

Permalink
fix(wakunode2): move node config inside app init branch (#2423)
Browse files Browse the repository at this point in the history
  • Loading branch information
rymnc authored Feb 13, 2024
1 parent 50308ed commit 0dac9f9
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions apps/wakunode2/wakunode2.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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 #
##############
Expand Down

0 comments on commit 0dac9f9

Please sign in to comment.