mirror of https://github.com/waku-org/nwaku.git
Work in progress, cannot be applied as is. nim-presto link is broken here. ... but configurable rest-allow-origin for rest-server.
This commit is contained in:
parent
846f7505ba
commit
7f83d01551
|
@ -301,7 +301,7 @@ proc setupWakuApp*(app: var App): AppResult[void] =
|
|||
ok()
|
||||
|
||||
proc getPorts(listenAddrs: seq[MultiAddress]):
|
||||
AppResult[tuple[tcpPort, websocketPort: Option[Port]]] =
|
||||
AppResult[tuple[tcpPort, websocketPort: Option[Port]]] =
|
||||
|
||||
var tcpPort, websocketPort = none(Port)
|
||||
|
||||
|
@ -640,7 +640,10 @@ proc startRestServer(app: App, address: ValidIpAddress, port: Port, conf: WakuNo
|
|||
|
||||
return defaultResponse()
|
||||
|
||||
let server = ? newRestHttpServer(address, port, requestErrorHandler = requestErrorHandler)
|
||||
let allowedOrigin = if len(conf.restAllowOrigin) > 0: some(conf.restAllowOrigin.join(","))
|
||||
else: none(string)
|
||||
|
||||
let server = ? newRestHttpServer(address, port, allowedOrigin = allowedOrigin, requestErrorHandler = requestErrorHandler)
|
||||
|
||||
## Admin REST API
|
||||
installAdminApiHandlers(server.router, app.node)
|
||||
|
@ -680,7 +683,7 @@ proc startRestServer(app: App, address: ValidIpAddress, port: Port, conf: WakuNo
|
|||
|
||||
let filterCache = rest_filter_api.MessageCache.init()
|
||||
|
||||
let filterDiscoHandler =
|
||||
let filterDiscoHandler =
|
||||
if app.wakuDiscv5.isSome():
|
||||
some(defaultDiscoveryHandler(app.wakuDiscv5.get(), Filter))
|
||||
else: none(DiscoveryHandler)
|
||||
|
@ -695,7 +698,7 @@ proc startRestServer(app: App, address: ValidIpAddress, port: Port, conf: WakuNo
|
|||
notInstalledTab["filter"] = "/filter endpoints are not available. Please check your configuration: --filternode"
|
||||
|
||||
## Store REST API
|
||||
let storeDiscoHandler =
|
||||
let storeDiscoHandler =
|
||||
if app.wakuDiscv5.isSome():
|
||||
some(defaultDiscoveryHandler(app.wakuDiscv5.get(), Store))
|
||||
else: none(DiscoveryHandler)
|
||||
|
@ -705,7 +708,7 @@ proc startRestServer(app: App, address: ValidIpAddress, port: Port, conf: WakuNo
|
|||
## Light push API
|
||||
if conf.lightpushnode != "" and
|
||||
app.node.wakuLightpushClient != nil:
|
||||
let lightDiscoHandler =
|
||||
let lightDiscoHandler =
|
||||
if app.wakuDiscv5.isSome():
|
||||
some(defaultDiscoveryHandler(app.wakuDiscv5.get(), Lightpush))
|
||||
else: none(DiscoveryHandler)
|
||||
|
|
|
@ -85,7 +85,7 @@ type
|
|||
desc: "Runs the registration function on-chain. By default, a dry-run will occur",
|
||||
defaultValue: false,
|
||||
name: "execute" .}: bool
|
||||
|
||||
|
||||
|
||||
of noCommand:
|
||||
## Application-level configuration
|
||||
|
@ -208,7 +208,7 @@ type
|
|||
desc: "Rln relay identity commitment key as a Hex string",
|
||||
defaultValue: ""
|
||||
name: "rln-relay-id-commitment-key" }: string
|
||||
|
||||
|
||||
rlnRelayTreePath* {.
|
||||
desc: "Path to the RLN merkle tree sled db (https://github.com/spacejam/sled)",
|
||||
defaultValue: ""
|
||||
|
@ -361,6 +361,14 @@ type
|
|||
defaultValue: false
|
||||
name: "rest-private" }: bool
|
||||
|
||||
restAllowOrigin* {.
|
||||
desc: "Allow cross-origin requests from the specified origin." &
|
||||
"Argument may be repeated." &
|
||||
"Wildcards: * or ? allowed." &
|
||||
"Ex.: \"localhost:*\" or \"127.0.0.1:8080\"",
|
||||
defaultValue: @[""]
|
||||
name: "rest-allow-origin" }: seq[string]
|
||||
|
||||
## Metrics config
|
||||
|
||||
metricsServer* {.
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 5ca16485e4d74e531d50d289ebc0f869d9e6352b
|
||||
Subproject commit c18ccd989f1928a2b35b7f3c6f1144c278fa45d1
|
Loading…
Reference in New Issue