feat(SNM config): Add `rest` config params

This commit is contained in:
Emil Ivanichkov 2024-03-06 15:15:15 +02:00 committed by Emil Ivanichkov
parent 2ddcb2863f
commit 40543e3706
2 changed files with 50 additions and 3 deletions

View File

@ -1,9 +1,15 @@
import
options,
confutils/defs
confutils/defs,
confutils/std/net
import waku/waku_core
import ./network
export
defaultSNMRestPort, defaultAdminListenAddress,
parseCmdArg, completeCmdArg
type
SNMStartUpCmd* {.pure.} = enum
noCommand,
@ -16,7 +22,39 @@ type
defaultValue: SNMStartUpCmd.noCommand .}: SNMStartUpCmd
of SNMStartUpCmd.noCommand:
discard
restEnabled* {.
desc: "Enable the REST server"
defaultValue: true
name: "rest" .}: bool
restPort* {.
desc: "Port for the REST server"
defaultValue: defaultSNMRestPort
defaultValueDesc: $defaultSNMRestPortDesc
name: "rest-port" .}: Port
restAddress* {.
desc: "Listening address of the REST server"
defaultValue: defaultAdminListenAddress
defaultValueDesc: $defaultAdminListenAddressDesc
name: "rest-address" .}: IpAddress
restRequestTimeout* {.
defaultValue: 0
defaultValueDesc: "infinite"
desc: "The number of seconds to wait until complete REST request " &
"will be received"
name: "rest-request-timeout" .}: Natural
restMaxRequestBodySize* {.
defaultValue: 16_384
desc: "Maximum size of REST request body (kilobytes)"
name: "rest-max-body-size" .}: Natural
restMaxRequestHeadersSize* {.
defaultValue: 128
desc: "Maximum size of REST request headers (kilobytes)"
name: "rest-max-headers-size" .}: Natural
of SNMStartUpCmd.pair:
qr* {.

View File

@ -0,0 +1,9 @@
import confutils/std/net
const
defaultSNMRestPort* = 13000
defaultSNMRestPortDesc* = $defaultSNMRestPort
defaultAdminListenAddress* = (static parseIpAddress("127.0.0.1"))
defaultAdminListenAddressDesc* = $defaultAdminListenAddress