Skip to content

Commit

Permalink
wakunode2 config. adding new 'topic' config parameter.
Browse files Browse the repository at this point in the history
This new parameter can be repeated and we are starting to deprecate the
parameter 'topics', that expected to receive a space-separated list of
pubsubtopic to subscribe to.
  • Loading branch information
Ivansete-status committed May 12, 2023
1 parent b277ce1 commit 493f082
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
11 changes: 10 additions & 1 deletion apps/wakunode2/app.nim
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,16 @@ proc setupProtocols(node: WakuNode, conf: WakuNodeConf,
peerExchangeHandler = some(handlePeerExchange)

if conf.relay:
let pubsubTopics = conf.topics.split(" ")

var pubsubTopics = @[""]
if conf.topicsDeprecated != "":
if conf.topics != @["/waku/2/default-waku/proto"]:
return err("Please don't specify 'topics' and 'topic' simultaneously. Only use the 'topic' parameter")

# This clause (if conf.topicsDeprecated != "") should disapear in >= v0.18.0
pubsubTopics = conf.topicsDeprecated.split(" ")
else:
pubsubTopics = conf.topics
try:
await mountRelay(node, pubsubTopics, peerExchangeHandler = peerExchangeHandler)
except CatchableError:
Expand Down
13 changes: 8 additions & 5 deletions apps/wakunode2/config.nim
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ type
defaultValue: newSeq[ProtectedTopic](0)
name: "protected-topic" .}: seq[ProtectedTopic]


## Log configuration
logLevel* {.
desc: "Sets the log level for process. Supported levels: TRACE, DEBUG, INFO, NOTICE, WARN, ERROR or FATAL",
Expand All @@ -54,7 +53,6 @@ type
defaultValue: logging.LogFormat.TEXT,
name: "log-format" .}: logging.LogFormat


## General node config
agentString* {.
defaultValue: "nwaku",
Expand Down Expand Up @@ -207,11 +205,16 @@ type
defaultValue: false
name: "keep-alive" }: bool

topics* {.
desc: "Default topics to subscribe to (space separated list)."
defaultValue: "/waku/2/default-waku/proto"
topicsDeprecated* {.
desc: "Default topics to subscribe to (space separated list). DEPRECATED: please use repeated --topic argument instead."
defaultValue: ""
name: "topics" .}: string

topics* {.
desc: "Default topic to subscribe to. Argument may be repeated."
defaultValue: @["/waku/2/default-waku/proto"]
name: "topic" .}: seq[string]

## Store and message store config

store* {.
Expand Down

0 comments on commit 493f082

Please sign in to comment.