Json info (#115)
* make info return a json with an spr * add an `exec` target to the makefile
This commit is contained in:
parent
28ebb16767
commit
cf4a0a393e
5
Makefile
5
Makefile
|
@ -86,6 +86,11 @@ testAll: | build deps
|
||||||
echo -e $(BUILD_MSG) "build/testCodex" "build/testContracts" && \
|
echo -e $(BUILD_MSG) "build/testCodex" "build/testContracts" && \
|
||||||
$(ENV_SCRIPT) nim testAll $(NIM_PARAMS) codex.nims
|
$(ENV_SCRIPT) nim testAll $(NIM_PARAMS) codex.nims
|
||||||
|
|
||||||
|
# Builds the codex binary
|
||||||
|
exec: | build deps
|
||||||
|
echo -e $(BUILD_MSG) "build/$@" && \
|
||||||
|
$(ENV_SCRIPT) nim codex codex.nims
|
||||||
|
|
||||||
# symlink
|
# symlink
|
||||||
codex.nims:
|
codex.nims:
|
||||||
ln -s codex.nimble $@
|
ln -s codex.nimble $@
|
||||||
|
|
|
@ -46,7 +46,7 @@ proc test(name: string, srcDir = "tests/", lang = "c") =
|
||||||
exec "build/" & name
|
exec "build/" & name
|
||||||
|
|
||||||
task codex, "build codex binary":
|
task codex, "build codex binary":
|
||||||
buildBinary "codex"
|
buildBinary "codex", params = "-d:chronicles_runtime_filtering -d:chronicles_log_level=TRACE"
|
||||||
|
|
||||||
task testCodex, "Build & run Codex tests":
|
task testCodex, "Build & run Codex tests":
|
||||||
test "testCodex"
|
test "testCodex"
|
||||||
|
|
|
@ -25,6 +25,7 @@ import pkg/stew/byteutils
|
||||||
import pkg/confutils
|
import pkg/confutils
|
||||||
|
|
||||||
import pkg/libp2p/routing_record
|
import pkg/libp2p/routing_record
|
||||||
|
import pkg/libp2pdht/discv5/spr as spr
|
||||||
|
|
||||||
import ../node
|
import ../node
|
||||||
import ../blocktype
|
import ../blocktype
|
||||||
|
@ -260,14 +261,14 @@ proc initRestApi*(node: CodexNodeRef, conf: CodexConf): RestRouter =
|
||||||
## Print rudimentary node information
|
## Print rudimentary node information
|
||||||
##
|
##
|
||||||
|
|
||||||
var addrs: string
|
let json = %*{
|
||||||
for a in node.switch.peerInfo.addrs:
|
"id": $node.switch.peerInfo.peerId,
|
||||||
addrs &= "- " & $a & "\n"
|
"addrs": node.switch.peerInfo.addrs.mapIt( $it ),
|
||||||
|
"repo": $conf.dataDir,
|
||||||
|
"spr": node.switch.peerInfo.signedPeerRecord.toURI
|
||||||
|
}
|
||||||
|
|
||||||
return RestApiResponse.response(
|
return RestApiResponse.response($json)
|
||||||
"Id: " & $node.switch.peerInfo.peerId &
|
|
||||||
"\nAddrs: \n" & addrs &
|
|
||||||
"\nRoot Dir: " & $conf.dataDir)
|
|
||||||
|
|
||||||
router.api(
|
router.api(
|
||||||
MethodGet,
|
MethodGet,
|
||||||
|
|
Loading…
Reference in New Issue