public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
Send webhook
3e69304f
data/Dockerfiles/watchdog/watchdog.sh | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
Diff
diff --git a/data/Dockerfiles/watchdog/watchdog.sh b/data/Dockerfiles/watchdog/watchdog.sh
index 5d962309..741417c5 100755
--- a/data/Dockerfiles/watchdog/watchdog.sh
+++ b/data/Dockerfiles/watchdog/watchdog.sh
@@ -125,6 +125,7 @@ function notify_error() {
SUBJECT="${WATCHDOG_SUBJECT}: ${1}"
fi
+ # Send mail notification if enabled
if [[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]]; then
IFS=',' read -r -a MAIL_RCPTS <<< "${WATCHDOG_NOTIFY_EMAIL}"
for rcpt in "${MAIL_RCPTS[@]}"; do
@@ -158,6 +159,23 @@ function notify_error() {
fi
done
fi
+
+ # Send webhook notification if enabled
+ if [[ ! -z ${WATCHDOG_NOTIFY_WEBHOOK} ]]; then
+ if [[ -z ${WATCHDOG_NOTIFY_WEBHOOK_BODY} ]]; then
+ log_msg "No webhook body set, skipping webhook notification..."
+ return 1
+ fi
+
+ WEBHOOK_BODY=$(echo "${WATCHDOG_NOTIFY_WEBHOOK_BODY}" | envsubst '$SUBJECT,$BODY')
+
+ curl -X POST \
+ -H "Content-Type: application/json" \
+ -d ${WEBHOOK_BODY} \
+ ${WATCHDOG_NOTIFY_WEBHOOK}
+
+ log_msg "Posted notification to webhook"
+ fi
}
get_container_ip() {