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]
|
.}: seq[ProtectedTopic]
|
||||||
|
|
||||||
## General node config
|
## General node config
|
||||||
|
preset* {.
|
||||||
|
desc: "Network preset to use." & "Must be one of 'default'",
|
||||||
|
defaultValue: "default",
|
||||||
|
name: "preset"
|
||||||
|
.}: string
|
||||||
|
|
||||||
clusterId* {.
|
clusterId* {.
|
||||||
desc:
|
desc:
|
||||||
"Cluster id that the node is running in. Node in a different cluster id is disconnected.",
|
"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]
|
.}: seq[string]
|
||||||
|
|
||||||
shards* {.
|
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: @[],
|
defaultValue: @[],
|
||||||
name: "shard"
|
name: "shard"
|
||||||
.}: seq[uint16]
|
.}: seq[uint16]
|
||||||
|
|
|
@ -91,16 +91,8 @@ proc init*(T: type Waku, conf: WakuNodeConf): Result[Waku, string] =
|
||||||
|
|
||||||
logging.setupLog(conf.logLevel, conf.logFormat)
|
logging.setupLog(conf.logLevel, conf.logFormat)
|
||||||
|
|
||||||
case confCopy.clusterId
|
case confCopy.preset
|
||||||
|
of "default":
|
||||||
# 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:
|
|
||||||
let twnClusterConf = ClusterConf.TheWakuNetworkConf()
|
let twnClusterConf = ClusterConf.TheWakuNetworkConf()
|
||||||
if len(confCopy.shards) != 0:
|
if len(confCopy.shards) != 0:
|
||||||
confCopy.pubsubTopics =
|
confCopy.pubsubTopics =
|
||||||
|
@ -123,6 +115,7 @@ proc init*(T: type Waku, conf: WakuNodeConf): Result[Waku, string] =
|
||||||
else:
|
else:
|
||||||
discard
|
discard
|
||||||
|
|
||||||
|
# TODO: check that confCopy.shards are valid against the preset
|
||||||
info "Running nwaku node", version = git_version
|
info "Running nwaku node", version = git_version
|
||||||
logConfig(confCopy)
|
logConfig(confCopy)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue