mirror of
https://github.com/logos-messaging/logos-delivery.git
synced 2026-08-04 10:53:19 +00:00
remove customized cli args as confutils has no support for it
This commit is contained in:
parent
d194b6605f
commit
e41d31c074
@ -1,41 +0,0 @@
|
|||||||
{.push raises: [].}
|
|
||||||
|
|
||||||
import confutils, confutils/defs
|
|
||||||
import ../../tools/confutils/cli_args
|
|
||||||
|
|
||||||
export cli_args
|
|
||||||
|
|
||||||
## App-specific configuration for `logos_delivery_node`.
|
|
||||||
##
|
|
||||||
## `WakuNodeConf` is flattened in, so every waku switch (including the `cmd`
|
|
||||||
## subcommand discriminator) is hoisted into this type's CLI namespace. New
|
|
||||||
## app-only switches live alongside it and become global options, leaving the
|
|
||||||
## shared `WakuNodeConf` (and wakunode2) untouched.
|
|
||||||
type LogosDeliveryNodeConf* = object
|
|
||||||
waku* {.flatten.}: WakuNodeConf
|
|
||||||
|
|
||||||
presetsFile* {.
|
|
||||||
desc: "Path to a presets file to load node presets from",
|
|
||||||
defaultValue: "",
|
|
||||||
name: "presets-file"
|
|
||||||
.}: string
|
|
||||||
|
|
||||||
proc load*(T: type LogosDeliveryNodeConf, version = ""): ConfResult[T] =
|
|
||||||
try:
|
|
||||||
let conf = LogosDeliveryNodeConf.load(
|
|
||||||
version = version,
|
|
||||||
secondarySources = proc(
|
|
||||||
conf: LogosDeliveryNodeConf, sources: auto
|
|
||||||
) {.gcsafe, raises: [ConfigurationError].} =
|
|
||||||
sources.addConfigFile(Envvar, InputFile("logosdeliverynode"))
|
|
||||||
|
|
||||||
if conf.waku.configFile.isSome():
|
|
||||||
sources.addConfigFile(Toml, conf.waku.configFile.get())
|
|
||||||
,
|
|
||||||
)
|
|
||||||
|
|
||||||
ok(conf)
|
|
||||||
except CatchableError:
|
|
||||||
err(getCurrentExceptionMsg())
|
|
||||||
|
|
||||||
{.pop.}
|
|
||||||
@ -8,7 +8,7 @@ import
|
|||||||
system/ansi_c,
|
system/ansi_c,
|
||||||
libp2p/crypto/crypto
|
libp2p/crypto/crypto
|
||||||
import
|
import
|
||||||
./conf,
|
../../tools/confutils/cli_args,
|
||||||
logos_delivery/logos_delivery,
|
logos_delivery/logos_delivery,
|
||||||
logos_delivery/waku/common/logging
|
logos_delivery/waku/common/logging
|
||||||
|
|
||||||
@ -30,15 +30,15 @@ when isMainModule:
|
|||||||
|
|
||||||
const versionString = "version / git commit hash: " & git_version
|
const versionString = "version / git commit hash: " & git_version
|
||||||
|
|
||||||
var nodeConf = LogosDeliveryNodeConf.load(version = versionString).valueOr:
|
var wakuNodeConf = WakuNodeConf.load(version = versionString).valueOr:
|
||||||
error "failure while loading the configuration", error = error
|
error "failure while loading the configuration", error = error
|
||||||
quit(QuitFailure)
|
quit(QuitFailure)
|
||||||
|
|
||||||
## Also called within LogosDelivery.new. The call to startRestServerEssentials
|
## Also called within LogosDelivery.new. The call to startRestServerEssentials
|
||||||
## needs the following line
|
## needs the following line
|
||||||
logging.setupLog(nodeConf.waku.logLevel, nodeConf.waku.logFormat)
|
logging.setupLog(wakuNodeConf.logLevel, wakuNodeConf.logFormat)
|
||||||
|
|
||||||
case nodeConf.waku.cmd
|
case wakuNodeConf.cmd
|
||||||
of generateRlnKeystore:
|
of generateRlnKeystore:
|
||||||
error "generateRlnKeystore not supported by logos_delivery_node; use wakunode2"
|
error "generateRlnKeystore not supported by logos_delivery_node; use wakunode2"
|
||||||
quit(QuitFailure)
|
quit(QuitFailure)
|
||||||
@ -46,7 +46,7 @@ when isMainModule:
|
|||||||
# `LogosDelivery` derives the per-layer config from `WakuNodeConf` itself
|
# `LogosDelivery` derives the per-layer config from `WakuNodeConf` itself
|
||||||
# (it runs `toWakuConf` internally), then builds the full stack bottom-up:
|
# (it runs `toWakuConf` internally), then builds the full stack bottom-up:
|
||||||
# Waku <- MessagingClient <- ReliableChannelManager
|
# Waku <- MessagingClient <- ReliableChannelManager
|
||||||
var node = (waitFor LogosDelivery.new(nodeConf.waku)).valueOr:
|
var node = (waitFor LogosDelivery.new(wakuNodeConf)).valueOr:
|
||||||
error "LogosDelivery initialization failed", error = error
|
error "LogosDelivery initialization failed", error = error
|
||||||
quit(QuitFailure)
|
quit(QuitFailure)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user