New helloworld endpoint useful when diagnosing

This commit is contained in:
kexkey
2019-08-06 19:05:49 -04:00
committed by kexkey
parent b43d6a273e
commit 2d126c473b
4 changed files with 9 additions and 2 deletions

View File

@@ -1,6 +1,7 @@
# The file api.properties generated by the installer should look like this.
# Stats can:
action_helloworld=stats
action_getblockchaininfo=stats
action_installation_info=stats
action_getmempoolinfo=stats

View File

@@ -4,6 +4,7 @@
# Admin can do what the spender can do plus even more stuff
# Stats can:
action_helloworld=stats
action_getblockchaininfo=stats
action_installation_info=stats
action_getmempoolinfo=stats

View File

@@ -100,7 +100,7 @@ checknotifier() {
local response
local returncode
response=$(mosquitto_rr -h broker -W 15 -t notifier -e "response/$$" -m "{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"http://proxy:8888/getbestblockhash\"}")
response=$(mosquitto_rr -h broker -W 15 -t notifier -e "response/$$" -m "{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"http://proxy:8888/helloworld\"}")
returncode=$?
[ "${returncode}" -ne "0" ] && return 115
http_code=$(echo "${response}" | jq ".http_code" | tr -d '"')

View File

@@ -72,6 +72,11 @@ main()
trace "[main] line=${line}"
fi
case "${cmd}" in
helloworld)
# GET http://192.168.111.152:8080/helloworld
response_to_client "Hello, world!" 0
break
;;
installation_info)
# GET http://192.168.111.152:8080/info
if [ -f "$DB_PATH/info.json" ]; then
@@ -286,7 +291,7 @@ main()
;;
getmempoolinfo)
# curl GET http://192.168.111.152:8080/getmempoolinfo
response=$(get_mempool_info)
response_to_client "${response}" ${?}
break