More TOR configurations

This commit is contained in:
kexkey
2019-12-09 11:08:35 -05:00
committed by kexkey
parent 51cb4a2e9a
commit d0afa09181
12 changed files with 56 additions and 40 deletions

View File

@@ -249,7 +249,7 @@ curl_callback() {
local returncode
notify_web "${1}" "${2}"
notify_web "${1}" "${2}" ${TOR_ADDR_WATCH_WEBHOOKS}
returncode=$?
trace_rc ${returncode}

View File

@@ -115,7 +115,7 @@ curl_callback_txid() {
local returncode
notify_web "${1}" "${2}"
notify_web "${1}" "${2}" ${TOR_TXID_WATCH_WEBHOOKS}
returncode=$?
trace_rc ${returncode}

View File

@@ -6,6 +6,7 @@ notify_web() {
trace "Entering notify_web()..."
local url=${1}
local torbypass=${3}
# Let's encode the body to base64 so we won't have to escape the special chars...
local body=$(echo "${2}" | base64 | tr -d '\n')
@@ -14,10 +15,17 @@ notify_web() {
local response
local http_code
local curl_code
local msg
if [ -n "${torbypass}" ]; then
msg="{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\",\"torbypass\":${torbypass}}"
else
msg="{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\"}"
fi
# We use the pid as the response-topic, so there's no conflict in responses.
trace "[notify_web] mosquitto_rr -h broker -W 21 -t notifier -e \"response/$$\" -m \"{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\"}\""
response=$(mosquitto_rr -h broker -W 21 -t notifier -e "response/$$" -m "{\"response-topic\":\"response/$$\",\"cmd\":\"web\",\"url\":\"${url}\",\"body\":\"${body}\"}")
trace "[notify_web] mosquitto_rr -h broker -W 21 -t notifier -e \"response/$$\" -m \"${msg}\""
response=$(mosquitto_rr -h broker -W 21 -t notifier -e "response/$$" -m ${msg})
returncode=$?
trace_rc ${returncode}

View File

@@ -213,7 +213,7 @@ serve_ots_backoffice() {
if [ -n ${url} ]; then
trace "[serve_ots_backoffice] url is not empty, now trying to call it!"
notify_web "${url}"
notify_web "${url}" ${TOR_OTS_WEBHOOKS}
returncode=$?
trace_rc ${returncode}