pass config
This commit is contained in:
parent
ec6f3b8058
commit
45fe5ee8ff
|
@ -123,7 +123,7 @@ proc new*(T: type DaggerServer, config: DaggerConf): T =
|
|||
erasure = Erasure.new(store, leoEncoderProvider, leoDecoderProvider)
|
||||
daggerNode = DaggerNodeRef.new(switch, store, engine, erasure, discovery)
|
||||
restServer = RestServerRef.new(
|
||||
daggerNode.initRestApi(),
|
||||
daggerNode.initRestApi(config),
|
||||
initTAddress("127.0.0.1" , config.apiPort),
|
||||
bufferSize = (1024 * 64),
|
||||
maxRequestBodySize = int.high)
|
||||
|
|
|
@ -21,11 +21,13 @@ import pkg/chronos
|
|||
import pkg/presto
|
||||
import pkg/libp2p
|
||||
import pkg/stew/base10
|
||||
import pkg/confutils
|
||||
|
||||
import pkg/libp2p/routing_record
|
||||
|
||||
import ../node
|
||||
import ../blocktype
|
||||
import ../conf
|
||||
|
||||
proc validate(
|
||||
pattern: string,
|
||||
|
@ -83,7 +85,7 @@ proc decodeString(T: type bool, value: string): Result[T, cstring] =
|
|||
proc encodeString(value: bool): Result[string, cstring] =
|
||||
ok($value)
|
||||
|
||||
proc initRestApi*(node: DaggerNodeRef): RestRouter =
|
||||
proc initRestApi*(node: DaggerNodeRef, conf: DaggerConf): RestRouter =
|
||||
var router = RestRouter.init(validate)
|
||||
router.api(
|
||||
MethodGet,
|
||||
|
@ -318,6 +320,7 @@ proc initRestApi*(node: DaggerNodeRef): RestRouter =
|
|||
|
||||
return RestApiResponse.response(
|
||||
"Id: " & $node.switch.peerInfo.peerId &
|
||||
"\nAddrs: \n" & addrs & "\n")
|
||||
"\nAddrs: \n" & addrs &
|
||||
"\nRoot Dir: " & $conf.dataDir)
|
||||
|
||||
return router
|
||||
|
|
Loading…
Reference in New Issue