mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-05 23:43:07 +00:00
Split `WakuNodeConfig` object for better separation of concerns and to introduce a tree-like structure to configuration. * fix: ensure twn cluster conf is still applied when clusterId=1 * test: remove usage of `WakuNodeConf` * Remove macro, split builder files, remove wakunodeconf from tests * rm network_conf_builder module as it is not used --------- Co-authored-by: NagyZoltanPeter <113987313+NagyZoltanPeter@users.noreply.github.com> Co-authored-by: Ivan Folgueira Bande <ivansete@status.im>
35 lines
1.2 KiB
Nim
35 lines
1.2 KiB
Nim
import std/[net, options, strutils]
|
|
import libp2p/multiaddress
|
|
|
|
type WebSocketSecureConf* {.requiresInit.} = object
|
|
keyPath*: string
|
|
certPath*: string
|
|
|
|
type WebSocketConf* = object
|
|
port*: Port
|
|
secureConf*: Option[WebSocketSecureConf]
|
|
|
|
type NetworkConf* = object
|
|
natStrategy*: string # TODO: make enum
|
|
p2pTcpPort*: Port
|
|
dns4DomainName*: Option[string]
|
|
p2pListenAddress*: IpAddress
|
|
extMultiAddrs*: seq[MultiAddress]
|
|
extMultiAddrsOnly*: bool
|
|
webSocketConf*: Option[WebSocketConf]
|
|
|
|
proc validateNoEmptyStrings(networkConf: NetworkConf): Result[void, string] =
|
|
if networkConf.dns4DomainName.isSome() and
|
|
isEmptyOrWhiteSpace(networkConf.dns4DomainName.get().string):
|
|
return err("dns4DomainName is an empty string, set it to none(string) instead")
|
|
|
|
if networkConf.webSocketConf.isSome() and
|
|
networkConf.webSocketConf.get().secureConf.isSome():
|
|
let secureConf = networkConf.webSocketConf.get().secureConf.get()
|
|
if isEmptyOrWhiteSpace(secureConf.keyPath):
|
|
return err("websocket.secureConf.keyPath is an empty string")
|
|
if isEmptyOrWhiteSpace(secureConf.certPath):
|
|
return err("websocket.secureConf.certPath is an empty string")
|
|
|
|
return ok()
|