mirror of
https://github.com/waku-org/nwaku.git
synced 2025-02-10 14:06:38 +00:00
Fix nim-waku config inconsistencies (#543)
* Fix nim-waku config inconsistencies * Revert staticnode to singular form * Fix reference to deprecated config item * Revert nodekey config item to be consistent with Waku v1
This commit is contained in:
parent
4f132a1d35
commit
50f2235bfc
@ -242,15 +242,15 @@ proc processInput(rfd: AsyncFD, rng: ref BrHmacDrbgContext) {.async.} =
|
|||||||
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
|
(extIp, extTcpPort, extUdpPort) = setupNat(conf.nat, clientId,
|
||||||
Port(uint16(conf.tcpPort) + conf.portsShift),
|
Port(uint16(conf.tcpPort) + conf.portsShift),
|
||||||
Port(uint16(conf.udpPort) + conf.portsShift))
|
Port(uint16(conf.udpPort) + conf.portsShift))
|
||||||
node = WakuNode.init(conf.nodeKey, conf.listenAddress,
|
node = WakuNode.init(conf.nodekey, conf.listenAddress,
|
||||||
Port(uint16(conf.tcpPort) + conf.portsShift), extIp, extTcpPort)
|
Port(uint16(conf.tcpPort) + conf.portsShift), extIp, extTcpPort)
|
||||||
|
|
||||||
await node.start()
|
await node.start()
|
||||||
|
|
||||||
if conf.filternode != "":
|
if conf.filternode != "":
|
||||||
node.mountRelay(conf.topics.split(" "), rlnRelayEnabled = conf.rlnrelay, keepAlive = conf.keepAlive)
|
node.mountRelay(conf.topics.split(" "), rlnRelayEnabled = (conf.rlnrelay_depr or conf.rlnRelay), keepAlive = conf.keepAlive) # @TODO remove deprecated config item
|
||||||
else:
|
else:
|
||||||
node.mountRelay(@[], rlnRelayEnabled = conf.rlnrelay, keepAlive = conf.keepAlive)
|
node.mountRelay(@[], rlnRelayEnabled = (conf.rlnrelay_depr or conf.rlnRelay), keepAlive = conf.keepAlive) # @TODO remove deprecated config item
|
||||||
|
|
||||||
let nick = await readNick(transp)
|
let nick = await readNick(transp)
|
||||||
echo "Welcome, " & nick & "!"
|
echo "Welcome, " & nick & "!"
|
||||||
@ -277,7 +277,7 @@ proc processInput(rfd: AsyncFD, rng: ref BrHmacDrbgContext) {.async.} =
|
|||||||
node.mountSwap()
|
node.mountSwap()
|
||||||
|
|
||||||
if (conf.storenode != "") or (conf.store == true):
|
if (conf.storenode != "") or (conf.store == true):
|
||||||
node.mountStore(persistMessages = conf.persistmessages)
|
node.mountStore(persistMessages = conf.persistMessages)
|
||||||
|
|
||||||
var storenode: string
|
var storenode: string
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ type
|
|||||||
name: "metrics-server-port" .}: uint16
|
name: "metrics-server-port" .}: uint16
|
||||||
|
|
||||||
### Waku v2 options
|
### Waku v2 options
|
||||||
|
|
||||||
staticnodes* {.
|
staticnodes* {.
|
||||||
desc: "Multiaddr of peer to directly connect with. Argument may be repeated"
|
desc: "Multiaddr of peer to directly connect with. Argument may be repeated"
|
||||||
name: "staticnode" }: seq[string]
|
name: "staticnode" }: seq[string]
|
||||||
|
@ -77,36 +77,65 @@ type
|
|||||||
name: "metrics-server-port" .}: uint16
|
name: "metrics-server-port" .}: uint16
|
||||||
|
|
||||||
### Waku v1 options
|
### Waku v1 options
|
||||||
fleetv1* {.
|
# @TODO: deprecate this item. Name changed from `fleetv1` -> `fleet-v1`
|
||||||
|
fleetv1_depr* {.
|
||||||
desc: "Select the Waku v1 fleet to connect to"
|
desc: "Select the Waku v1 fleet to connect to"
|
||||||
defaultValue: FleetV1.none
|
defaultValue: FleetV1.none
|
||||||
name: "fleetv1" .}: FleetV1
|
name: "fleetv1" .}: FleetV1
|
||||||
|
|
||||||
staticnodesv1* {.
|
fleetV1* {.
|
||||||
|
desc: "Select the Waku v1 fleet to connect to"
|
||||||
|
defaultValue: FleetV1.none
|
||||||
|
name: "fleet-v1" .}: FleetV1
|
||||||
|
|
||||||
|
# @TODO: deprecate this item. Name changed from `staticnodev1` -> `staticnodes-v1`
|
||||||
|
staticnodesv1_depr* {.
|
||||||
desc: "Enode URL to directly connect with. Argument may be repeated"
|
desc: "Enode URL to directly connect with. Argument may be repeated"
|
||||||
name: "staticnodev1" .}: seq[string]
|
name: "staticnodev1" .}: seq[string]
|
||||||
|
|
||||||
nodekeyv1* {.
|
staticnodesV1* {.
|
||||||
|
desc: "Enode URL to directly connect with. Argument may be repeated"
|
||||||
|
name: "staticnode-v1" .}: seq[string]
|
||||||
|
|
||||||
|
# @TODO: deprecate this item. Name changed from `nodekeyv1` -> `node-key-v1`
|
||||||
|
nodekeyv1_depr* {.
|
||||||
desc: "DevP2P node private key as hex",
|
desc: "DevP2P node private key as hex",
|
||||||
# TODO: can the rng be passed in somehow via Load?
|
# TODO: can the rng be passed in somehow via Load?
|
||||||
defaultValue: keys.KeyPair.random(keys.newRng()[])
|
defaultValue: keys.KeyPair.random(keys.newRng()[])
|
||||||
name: "nodekeyv1" .}: keys.KeyPair
|
name: "nodekeyv1" .}: keys.KeyPair
|
||||||
|
|
||||||
|
nodekeyV1* {.
|
||||||
|
desc: "DevP2P node private key as hex",
|
||||||
|
# TODO: can the rng be passed in somehow via Load?
|
||||||
|
defaultValue: keys.KeyPair.random(keys.newRng()[])
|
||||||
|
name: "nodekey-v1" .}: keys.KeyPair
|
||||||
|
|
||||||
wakuPow* {.
|
wakuPow* {.
|
||||||
desc: "PoW requirement of Waku node.",
|
desc: "PoW requirement of Waku node.",
|
||||||
defaultValue: 0.002
|
defaultValue: 0.002
|
||||||
name: "waku-pow" .}: float64
|
name: "waku-pow" .}: float64
|
||||||
|
|
||||||
### Waku v2 options
|
### Waku v2 options
|
||||||
staticnodesv2* {.
|
# @TODO: deprecate this item. Name changed from `staticnodev2` -> `staticnodes-v2`
|
||||||
|
staticnodesv2_depr* {.
|
||||||
desc: "Multiaddr of peer to directly connect with. Argument may be repeated"
|
desc: "Multiaddr of peer to directly connect with. Argument may be repeated"
|
||||||
name: "staticnodev2" }: seq[string]
|
name: "staticnodev2" }: seq[string]
|
||||||
|
|
||||||
nodekeyv2* {.
|
staticnodesV2* {.
|
||||||
|
desc: "Multiaddr of peer to directly connect with. Argument may be repeated"
|
||||||
|
name: "staticnode-v2" }: seq[string]
|
||||||
|
|
||||||
|
# @TODO: deprecate this item. Name changed from `nodekeyv2` -> `node-key-v2`
|
||||||
|
nodekeyv2_depr* {.
|
||||||
desc: "P2P node private key as hex"
|
desc: "P2P node private key as hex"
|
||||||
defaultValue: crypto.PrivateKey.random(Secp256k1, keys.newRng()[]).tryGet()
|
defaultValue: crypto.PrivateKey.random(Secp256k1, keys.newRng()[]).tryGet()
|
||||||
name: "nodekeyv2" }: crypto.PrivateKey
|
name: "nodekeyv2" }: crypto.PrivateKey
|
||||||
|
|
||||||
|
nodekeyV2* {.
|
||||||
|
desc: "P2P node private key as hex"
|
||||||
|
defaultValue: crypto.PrivateKey.random(Secp256k1, keys.newRng()[]).tryGet()
|
||||||
|
name: "nodekey-v2" }: crypto.PrivateKey
|
||||||
|
|
||||||
topics* {.
|
topics* {.
|
||||||
desc: "Default topics to subscribe to (space separated list)"
|
desc: "Default topics to subscribe to (space separated list)"
|
||||||
defaultValue: "/waku/2/default-waku/proto"
|
defaultValue: "/waku/2/default-waku/proto"
|
||||||
@ -117,11 +146,6 @@ type
|
|||||||
defaultValue: true
|
defaultValue: true
|
||||||
name: "store" }: bool
|
name: "store" }: bool
|
||||||
|
|
||||||
persistmessages* {.
|
|
||||||
desc: "Enable message persistence: true|false",
|
|
||||||
defaultValue: false
|
|
||||||
name: "persist-messages" }: bool
|
|
||||||
|
|
||||||
filter* {.
|
filter* {.
|
||||||
desc: "Flag whether to start filter protocol",
|
desc: "Flag whether to start filter protocol",
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
|
@ -200,11 +200,11 @@ when isMainModule:
|
|||||||
Port(uint16(conf.udpPort) + conf.portsShift))
|
Port(uint16(conf.udpPort) + conf.portsShift))
|
||||||
|
|
||||||
let
|
let
|
||||||
bridge = WakuBridge.new(nodev1Key = conf.nodekeyv1,
|
bridge = WakuBridge.new(nodev1Key = conf.nodekeyv1_depr, # @TODO remove deprecated config item
|
||||||
nodev1Address = nodev1Address,
|
nodev1Address = nodev1Address,
|
||||||
powRequirement = conf.wakuPow,
|
powRequirement = conf.wakuPow,
|
||||||
rng = rng,
|
rng = rng,
|
||||||
nodev2Key = conf.nodeKeyv2,
|
nodev2Key = conf.nodekeyv2_depr, # @TODO remove deprecated config item
|
||||||
nodev2BindIp = conf.listenAddress, nodev2BindPort = Port(uint16(conf.libp2pTcpPort) + conf.portsShift),
|
nodev2BindIp = conf.listenAddress, nodev2BindPort = Port(uint16(conf.libp2pTcpPort) + conf.portsShift),
|
||||||
nodev2ExtIp = nodev2ExtIp, nodev2ExtPort = nodev2ExtPort)
|
nodev2ExtIp = nodev2ExtIp, nodev2ExtPort = nodev2ExtPort)
|
||||||
|
|
||||||
@ -212,20 +212,28 @@ when isMainModule:
|
|||||||
|
|
||||||
# Now load rest of config
|
# Now load rest of config
|
||||||
# Optionally direct connect nodev1 with a set of nodes
|
# Optionally direct connect nodev1 with a set of nodes
|
||||||
if conf.staticnodesv1.len > 0: connectToNodes(bridge.nodev1, conf.staticnodesv1)
|
# @TODO remove deprecated config items
|
||||||
elif conf.fleetv1 == prod: connectToNodes(bridge.nodev1, WhisperNodes)
|
if conf.staticnodesv1_depr.len > 0: connectToNodes(bridge.nodev1, conf.staticnodesv1_depr)
|
||||||
elif conf.fleetv1 == staging: connectToNodes(bridge.nodev1, WhisperNodesStaging)
|
elif conf.fleetv1_depr == prod: connectToNodes(bridge.nodev1, WhisperNodes)
|
||||||
elif conf.fleetv1 == test: connectToNodes(bridge.nodev1, WhisperNodesTest)
|
elif conf.fleetv1_depr == staging: connectToNodes(bridge.nodev1, WhisperNodesStaging)
|
||||||
|
elif conf.fleetv1_depr == test: connectToNodes(bridge.nodev1, WhisperNodesTest)
|
||||||
|
|
||||||
|
if conf.staticnodesV1.len > 0: connectToNodes(bridge.nodev1, conf.staticnodesV1)
|
||||||
|
elif conf.fleetV1 == prod: connectToNodes(bridge.nodev1, WhisperNodes)
|
||||||
|
elif conf.fleetV1 == staging: connectToNodes(bridge.nodev1, WhisperNodesStaging)
|
||||||
|
elif conf.fleetV1 == test: connectToNodes(bridge.nodev1, WhisperNodesTest)
|
||||||
|
|
||||||
# Mount configured Waku v2 protocols
|
# Mount configured Waku v2 protocols
|
||||||
if conf.store:
|
if conf.store:
|
||||||
mountStore(bridge.nodev2, persistMessages = conf.persistmessages)
|
mountStore(bridge.nodev2, persistMessages = false) # Bridge does not persist messages
|
||||||
|
|
||||||
if conf.filter:
|
if conf.filter:
|
||||||
mountFilter(bridge.nodev2)
|
mountFilter(bridge.nodev2)
|
||||||
|
|
||||||
if conf.staticnodesv2.len > 0:
|
if conf.staticnodesv2_depr.len > 0: # @TODO remove deprecated config item
|
||||||
waitFor connectToNodes(bridge.nodev2, conf.staticnodesv2)
|
waitFor connectToNodes(bridge.nodev2, conf.staticnodesv2_depr)
|
||||||
|
elif conf.staticnodesV2.len > 0:
|
||||||
|
waitFor connectToNodes(bridge.nodev2, conf.staticnodesV2)
|
||||||
|
|
||||||
if conf.storenode != "":
|
if conf.storenode != "":
|
||||||
setStorePeer(bridge.nodev2, conf.storenode)
|
setStorePeer(bridge.nodev2, conf.storenode)
|
||||||
|
@ -9,11 +9,18 @@ import
|
|||||||
|
|
||||||
type
|
type
|
||||||
WakuNodeConf* = object
|
WakuNodeConf* = object
|
||||||
|
## General node config
|
||||||
|
|
||||||
logLevel* {.
|
logLevel* {.
|
||||||
desc: "Sets the log level."
|
desc: "Sets the log level."
|
||||||
defaultValue: LogLevel.INFO
|
defaultValue: LogLevel.INFO
|
||||||
name: "log-level" }: LogLevel
|
name: "log-level" }: LogLevel
|
||||||
|
|
||||||
|
nodekey* {.
|
||||||
|
desc: "P2P node private key as 64 char hex string.",
|
||||||
|
defaultValue: crypto.PrivateKey.random(Secp256k1, keys.newRng()[]).tryGet()
|
||||||
|
name: "nodekey" }: crypto.PrivateKey
|
||||||
|
|
||||||
listenAddress* {.
|
listenAddress* {.
|
||||||
defaultValue: defaultListenAddress(config)
|
defaultValue: defaultListenAddress(config)
|
||||||
desc: "Listening address for the LibP2P traffic."
|
desc: "Listening address for the LibP2P traffic."
|
||||||
@ -39,80 +46,106 @@ type
|
|||||||
"Must be one of: any, none, upnp, pmp, extip:<IP>."
|
"Must be one of: any, none, upnp, pmp, extip:<IP>."
|
||||||
defaultValue: "any" }: string
|
defaultValue: "any" }: string
|
||||||
|
|
||||||
staticnodes* {.
|
## Persistence config
|
||||||
desc: "Peer multiaddr to directly connect with. Argument may be repeated."
|
|
||||||
name: "staticnode" }: seq[string]
|
|
||||||
|
|
||||||
peerpersist* {.
|
# @TODO: deprecate this item. Name changed from `dbpath` -> `db-path`
|
||||||
|
dbpath_depr* {.
|
||||||
|
desc: "The database path for peristent storage",
|
||||||
|
defaultValue: ""
|
||||||
|
name: "dbpath" }: string
|
||||||
|
|
||||||
|
dbPath* {.
|
||||||
|
desc: "The database path for peristent storage",
|
||||||
|
defaultValue: ""
|
||||||
|
name: "db-path" }: string
|
||||||
|
|
||||||
|
# @TODO: deprecate this item. Name changed from `peerpersist` -> `persist-peers`
|
||||||
|
peerpersist_depr* {.
|
||||||
desc: "Enable peer persistence: true|false",
|
desc: "Enable peer persistence: true|false",
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
name: "peerpersist" }: bool
|
name: "peerpersist" }: bool
|
||||||
|
|
||||||
storenode* {.
|
persistPeers* {.
|
||||||
desc: "Peer multiaddr to query for storage.",
|
desc: "Enable peer persistence: true|false",
|
||||||
defaultValue: ""
|
defaultValue: false
|
||||||
name: "storenode" }: string
|
name: "persist-peers" }: bool
|
||||||
|
|
||||||
persistmessages* {.
|
persistMessages* {.
|
||||||
desc: "Enable message persistence: true|false",
|
desc: "Enable message persistence: true|false",
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
name: "persist-messages" }: bool
|
name: "persist-messages" }: bool
|
||||||
|
|
||||||
store* {.
|
## Relay config
|
||||||
desc: "Enable store protocol: true|false",
|
|
||||||
defaultValue: true
|
|
||||||
name: "store" }: bool
|
|
||||||
|
|
||||||
filter* {.
|
|
||||||
desc: "Enable filter protocol: true|false",
|
|
||||||
defaultValue: false
|
|
||||||
name: "filter" }: bool
|
|
||||||
|
|
||||||
relay* {.
|
relay* {.
|
||||||
desc: "Enable relay protocol: true|false",
|
desc: "Enable relay protocol: true|false",
|
||||||
defaultValue: true
|
defaultValue: true
|
||||||
name: "relay" }: bool
|
name: "relay" }: bool
|
||||||
|
|
||||||
rlnrelay* {.
|
# @TODO: deprecate this item. Name changed from `rlnrelay` -> `rln-relay`
|
||||||
|
rlnrelay_depr* {.
|
||||||
desc: "Enable spam protection through rln-relay: true|false",
|
desc: "Enable spam protection through rln-relay: true|false",
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
name: "rlnrelay" }: bool
|
name: "rlnrelay" }: bool
|
||||||
|
|
||||||
|
rlnRelay* {.
|
||||||
|
desc: "Enable spam protection through rln-relay: true|false",
|
||||||
|
defaultValue: false
|
||||||
|
name: "rln-relay" }: bool
|
||||||
|
|
||||||
|
staticnodes* {.
|
||||||
|
desc: "Peer multiaddr to directly connect with. Argument may be repeated."
|
||||||
|
name: "staticnode" }: seq[string]
|
||||||
|
|
||||||
keepAlive* {.
|
keepAlive* {.
|
||||||
desc: "Enable keep-alive for idle connections: true|false",
|
desc: "Enable keep-alive for idle connections: true|false",
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
name: "keep-alive" }: bool
|
name: "keep-alive" }: bool
|
||||||
|
|
||||||
swap* {.
|
topics* {.
|
||||||
desc: "Enable swap protocol: true|false",
|
desc: "Default topics to subscribe to (space separated list)."
|
||||||
defaultValue: false
|
defaultValue: "/waku/2/default-waku/proto"
|
||||||
name: "swap" }: bool
|
name: "topics" .}: string
|
||||||
|
|
||||||
lightpush* {.
|
## Store config
|
||||||
desc: "Enable lightpush protocol: true|false",
|
|
||||||
|
store* {.
|
||||||
|
desc: "Enable store protocol: true|false",
|
||||||
|
defaultValue: true
|
||||||
|
name: "store" }: bool
|
||||||
|
|
||||||
|
storenode* {.
|
||||||
|
desc: "Peer multiaddr to query for storage.",
|
||||||
|
defaultValue: ""
|
||||||
|
name: "storenode" }: string
|
||||||
|
|
||||||
|
## Filter config
|
||||||
|
|
||||||
|
filter* {.
|
||||||
|
desc: "Enable filter protocol: true|false",
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
name: "lightpush" }: bool
|
name: "filter" }: bool
|
||||||
|
|
||||||
filternode* {.
|
filternode* {.
|
||||||
desc: "Peer multiaddr to request content filtering of messages.",
|
desc: "Peer multiaddr to request content filtering of messages.",
|
||||||
defaultValue: ""
|
defaultValue: ""
|
||||||
name: "filternode" }: string
|
name: "filternode" }: string
|
||||||
|
|
||||||
dbpath* {.
|
## Swap config
|
||||||
desc: "The database path for the store protocol.",
|
|
||||||
defaultValue: ""
|
|
||||||
name: "dbpath" }: string
|
|
||||||
|
|
||||||
topics* {.
|
swap* {.
|
||||||
desc: "Default topics to subscribe to (space separated list)."
|
desc: "Enable swap protocol: true|false",
|
||||||
defaultValue: "/waku/2/default-waku/proto"
|
defaultValue: false
|
||||||
name: "topics" .}: string
|
name: "swap" }: bool
|
||||||
|
|
||||||
# NOTE: Signature is different here, we return PrivateKey and not KeyPair
|
## Lightpush config
|
||||||
nodekey* {.
|
|
||||||
desc: "P2P node private key as 64 char hex string.",
|
lightpush* {.
|
||||||
defaultValue: crypto.PrivateKey.random(Secp256k1, keys.newRng()[]).tryGet()
|
desc: "Enable lightpush protocol: true|false",
|
||||||
name: "nodekey" }: crypto.PrivateKey
|
defaultValue: false
|
||||||
|
name: "lightpush" }: bool
|
||||||
|
|
||||||
|
## JSON-RPC config
|
||||||
|
|
||||||
rpc* {.
|
rpc* {.
|
||||||
desc: "Enable Waku JSON-RPC server: true|false",
|
desc: "Enable Waku JSON-RPC server: true|false",
|
||||||
@ -139,6 +172,8 @@ type
|
|||||||
defaultValue: false
|
defaultValue: false
|
||||||
name: "rpc-private" }: bool
|
name: "rpc-private" }: bool
|
||||||
|
|
||||||
|
## Metrics config
|
||||||
|
|
||||||
metricsServer* {.
|
metricsServer* {.
|
||||||
desc: "Enable the metrics server: true|false"
|
desc: "Enable the metrics server: true|false"
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
@ -154,11 +189,17 @@ type
|
|||||||
defaultValue: 8008
|
defaultValue: 8008
|
||||||
name: "metrics-server-port" }: uint16
|
name: "metrics-server-port" }: uint16
|
||||||
|
|
||||||
logMetrics* {.
|
# @TODO: deprecate this item. Name changed from `log-metrics` -> `metrics-logging`
|
||||||
|
logMetrics_depr* {.
|
||||||
desc: "Enable metrics logging: true|false"
|
desc: "Enable metrics logging: true|false"
|
||||||
defaultValue: false
|
defaultValue: false
|
||||||
name: "log-metrics" }: bool
|
name: "log-metrics" }: bool
|
||||||
|
|
||||||
|
metricsLogging* {.
|
||||||
|
desc: "Enable metrics logging: true|false"
|
||||||
|
defaultValue: false
|
||||||
|
name: "metrics-logging" }: bool
|
||||||
|
|
||||||
# NOTE: Keys are different in nim-libp2p
|
# NOTE: Keys are different in nim-libp2p
|
||||||
proc parseCmdArg*(T: type crypto.PrivateKey, p: TaintedString): T =
|
proc parseCmdArg*(T: type crypto.PrivateKey, p: TaintedString): T =
|
||||||
try:
|
try:
|
||||||
|
@ -630,8 +630,15 @@ when isMainModule:
|
|||||||
# Storage setup
|
# Storage setup
|
||||||
var sqliteDatabase: SqliteDatabase
|
var sqliteDatabase: SqliteDatabase
|
||||||
|
|
||||||
if conf.dbpath != "":
|
if conf.dbpath_depr != "": # @TODO remove deprecated config item
|
||||||
let dbRes = SqliteDatabase.init(conf.dbpath)
|
let dbRes = SqliteDatabase.init(conf.dbpath_depr)
|
||||||
|
if dbRes.isErr:
|
||||||
|
warn "failed to init database", err = dbRes.error
|
||||||
|
waku_node_errors.inc(labelValues = ["init_db_failure"])
|
||||||
|
else:
|
||||||
|
sqliteDatabase = dbRes.value
|
||||||
|
elif conf.dbPath != "":
|
||||||
|
let dbRes = SqliteDatabase.init(conf.dbPath)
|
||||||
if dbRes.isErr:
|
if dbRes.isErr:
|
||||||
warn "failed to init database", err = dbRes.error
|
warn "failed to init database", err = dbRes.error
|
||||||
waku_node_errors.inc(labelValues = ["init_db_failure"])
|
waku_node_errors.inc(labelValues = ["init_db_failure"])
|
||||||
@ -640,7 +647,7 @@ when isMainModule:
|
|||||||
|
|
||||||
var pStorage: WakuPeerStorage
|
var pStorage: WakuPeerStorage
|
||||||
|
|
||||||
if conf.peerpersist and not sqliteDatabase.isNil:
|
if (conf.peerpersist_depr or conf.persistPeers) and not sqliteDatabase.isNil: # @TODO remove deprecated config item
|
||||||
let res = WakuPeerStorage.new(sqliteDatabase)
|
let res = WakuPeerStorage.new(sqliteDatabase)
|
||||||
if res.isErr:
|
if res.isErr:
|
||||||
warn "failed to init new WakuPeerStorage", err = res.error
|
warn "failed to init new WakuPeerStorage", err = res.error
|
||||||
@ -657,7 +664,7 @@ when isMainModule:
|
|||||||
## config, the external port is the same as the bind port.
|
## config, the external port is the same as the bind port.
|
||||||
extPort = if extIp.isSome() and extTcpPort.isNone(): some(Port(uint16(conf.tcpPort) + conf.portsShift))
|
extPort = if extIp.isSome() and extTcpPort.isNone(): some(Port(uint16(conf.tcpPort) + conf.portsShift))
|
||||||
else: extTcpPort
|
else: extTcpPort
|
||||||
node = WakuNode.init(conf.nodeKey,
|
node = WakuNode.init(conf.nodekey,
|
||||||
conf.listenAddress, Port(uint16(conf.tcpPort) + conf.portsShift),
|
conf.listenAddress, Port(uint16(conf.tcpPort) + conf.portsShift),
|
||||||
extIp, extPort,
|
extIp, extPort,
|
||||||
pStorage)
|
pStorage)
|
||||||
@ -673,7 +680,7 @@ when isMainModule:
|
|||||||
if (conf.storenode != "") or (conf.store):
|
if (conf.storenode != "") or (conf.store):
|
||||||
var store: WakuMessageStore
|
var store: WakuMessageStore
|
||||||
|
|
||||||
if (not sqliteDatabase.isNil) and conf.persistmessages:
|
if (not sqliteDatabase.isNil) and conf.persistMessages:
|
||||||
let res = WakuMessageStore.init(sqliteDatabase)
|
let res = WakuMessageStore.init(sqliteDatabase)
|
||||||
if res.isErr:
|
if res.isErr:
|
||||||
warn "failed to init WakuMessageStore", err = res.error
|
warn "failed to init WakuMessageStore", err = res.error
|
||||||
@ -681,7 +688,7 @@ when isMainModule:
|
|||||||
else:
|
else:
|
||||||
store = res.value
|
store = res.value
|
||||||
|
|
||||||
mountStore(node, store, conf.persistmessages)
|
mountStore(node, store, conf.persistMessages)
|
||||||
|
|
||||||
if conf.storenode != "":
|
if conf.storenode != "":
|
||||||
setStorePeer(node, conf.storenode)
|
setStorePeer(node, conf.storenode)
|
||||||
@ -689,7 +696,7 @@ when isMainModule:
|
|||||||
# Relay setup
|
# Relay setup
|
||||||
mountRelay(node,
|
mountRelay(node,
|
||||||
conf.topics.split(" "),
|
conf.topics.split(" "),
|
||||||
rlnRelayEnabled = conf.rlnrelay,
|
rlnRelayEnabled = conf.rlnrelay_depr or conf.rlnRelay, # @TODO remove deprecated config item
|
||||||
keepAlive = conf.keepAlive,
|
keepAlive = conf.keepAlive,
|
||||||
relayMessages = conf.relay) # Indicates if node is capable to relay messages
|
relayMessages = conf.relay) # Indicates if node is capable to relay messages
|
||||||
|
|
||||||
@ -710,7 +717,7 @@ when isMainModule:
|
|||||||
if conf.rpc:
|
if conf.rpc:
|
||||||
startRpc(node, conf.rpcAddress, Port(conf.rpcPort + conf.portsShift), conf)
|
startRpc(node, conf.rpcAddress, Port(conf.rpcPort + conf.portsShift), conf)
|
||||||
|
|
||||||
if conf.logMetrics:
|
if conf.logMetrics_depr or conf.metricsLogging: # @TODO remove deprecated config item
|
||||||
startMetricsLog()
|
startMetricsLog()
|
||||||
|
|
||||||
when defined(insecure):
|
when defined(insecure):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user