mirror of https://github.com/waku-org/nwaku.git
feat: propose `preset` option instead of deducing from cluster-id
This commit is contained in:
parent
55c94b4b5e
commit
3e39a2343a
|
@ -127,6 +127,12 @@ type WakuNodeConf* = object
|
|||
.}: seq[ProtectedTopic]
|
||||
|
||||
## General node config
|
||||
preset* {.
|
||||
desc: "Network preset to use." & "Must be one of 'default'",
|
||||
defaultValue: "default",
|
||||
name: "preset"
|
||||
.}: string
|
||||
|
||||
clusterId* {.
|
||||
desc:
|
||||
"Cluster id that the node is running in. Node in a different cluster id is disconnected.",
|
||||
|
@ -253,7 +259,9 @@ type WakuNodeConf* = object
|
|||
.}: seq[string]
|
||||
|
||||
shards* {.
|
||||
desc: "Shards index to subscribe to [0.." & $MaxShardIndex & "]. Argument may be repeated.",
|
||||
desc:
|
||||
"Shards index to subscribe to [0.." & $MaxShardIndex &
|
||||
"]. Argument may be repeated.",
|
||||
defaultValue: @[],
|
||||
name: "shard"
|
||||
.}: seq[uint16]
|
||||
|
|
|
@ -91,16 +91,8 @@ proc init*(T: type Waku, conf: WakuNodeConf): Result[Waku, string] =
|
|||
|
||||
logging.setupLog(conf.logLevel, conf.logFormat)
|
||||
|
||||
case confCopy.clusterId
|
||||
|
||||
# cluster-id=0
|
||||
of 0:
|
||||
let clusterZeroConf = ClusterConf.ClusterZeroConf()
|
||||
confCopy.pubsubTopics = clusterZeroConf.pubsubTopics
|
||||
# TODO: Write some template to "merge" the configs
|
||||
|
||||
# cluster-id=1 (aka The Waku Network)
|
||||
of 1:
|
||||
case confCopy.preset
|
||||
of "default":
|
||||
let twnClusterConf = ClusterConf.TheWakuNetworkConf()
|
||||
if len(confCopy.shards) != 0:
|
||||
confCopy.pubsubTopics =
|
||||
|
@ -123,6 +115,7 @@ proc init*(T: type Waku, conf: WakuNodeConf): Result[Waku, string] =
|
|||
else:
|
||||
discard
|
||||
|
||||
# TODO: check that confCopy.shards are valid against the preset
|
||||
info "Running nwaku node", version = git_version
|
||||
logConfig(confCopy)
|
||||
|
||||
|
|
Loading…
Reference in New Issue