mirror of
https://github.com/aljazceru/cyphernode.git
synced 2025-12-18 21:25:06 +01:00
More comments, cleaned code
This commit is contained in:
@@ -14,11 +14,14 @@ notify_web() {
|
||||
local response
|
||||
local http_code
|
||||
|
||||
# We use the pid as the response-topic, so there's no conflict in responses.
|
||||
trace "[notify_web] mosquitto_rr -h broker -W 5 -t notifier -e \"response/$$\" -m \"{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\"}\""
|
||||
response=$(mosquitto_rr -h broker -W 5 -t notifier -e "response/$$" -m "{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\"}")
|
||||
returncode=$?
|
||||
trace_rc ${returncode}
|
||||
|
||||
# The response looks like this: {"curl_code":0,"http_code":200,"body":"..."} where the body
|
||||
# is the base64(response body) but we don't need the response content here.
|
||||
trace "[notify_web] response=${response}"
|
||||
http_code=$(echo "${response}" | jq ".http_code" | tr -d '"')
|
||||
trace "[notify_web] http_code=${http_code}"
|
||||
|
||||
Reference in New Issue
Block a user