mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-10-08 22:46:41 +00:00
fix(backup): send host backup notifications over HTTPS when the Monitor uses it
This commit is contained in:
@@ -805,8 +805,12 @@ if command -v curl >/dev/null 2>&1; then
|
||||
"$POSTBOOT_DURATION_FMT" \
|
||||
"$SANITY_WARNINGS")
|
||||
fi
|
||||
NOTIFY_HTTP=$(curl -s -o /dev/null -w '%{http_code}' \
|
||||
-X POST "http://127.0.0.1:8008/api/internal/restore-event" \
|
||||
# The Monitor answers on the same port over HTTPS once it has a certificate.
|
||||
NOTIFY_SCHEME="http"
|
||||
grep -Eq '"enabled"[[:space:]]*:[[:space:]]*true' /etc/proxmenux/ssl_config.json 2>/dev/null && \
|
||||
NOTIFY_SCHEME="https"
|
||||
NOTIFY_HTTP=$(curl -sk -o /dev/null -w '%{http_code}' \
|
||||
-X POST "${NOTIFY_SCHEME}://127.0.0.1:8008/api/internal/restore-event" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$PAYLOAD" \
|
||||
--max-time 5 2>/dev/null || echo "000")
|
||||
|
||||
@@ -3420,11 +3420,16 @@ Log: ${HB_NOTIFY_LOG_FILE:-}"
|
||||
log_file:$log, reason:$reason}}' \
|
||||
2>/dev/null)
|
||||
[[ -z "$payload" ]] && return 0
|
||||
# The Monitor answers on the same port over HTTPS once it has a certificate.
|
||||
local scheme="http"
|
||||
[[ -f /etc/proxmenux/ssl_config.json ]] && \
|
||||
jq -e '.enabled' /etc/proxmenux/ssl_config.json >/dev/null 2>&1 && \
|
||||
scheme="https"
|
||||
curl -sk --connect-timeout 3 --max-time 5 \
|
||||
-X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "$payload" \
|
||||
http://127.0.0.1:8008/api/notifications/webhook \
|
||||
"${scheme}://127.0.0.1:8008/api/notifications/webhook" \
|
||||
>/dev/null 2>&1 || true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user