mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-14 15:28:22 +01:00
Ntfy.sh and authentication (#220)
* default.config: add NtfyAuth= * notify_templates/notify_ntfy.sh: implement NtfyAuth --------- Co-authored-by: Lat <lat@mail.com> Co-authored-by: mag37 <robin.ivehult@gmail.com>
This commit is contained in:
parent
fbc9a252f5
commit
9156cc44e1
2 changed files with 10 additions and 2 deletions
|
|
@ -68,6 +68,7 @@
|
|||
## https://ntfy.sh or your custom domain with https:// and no trailing /
|
||||
# NTFY_DOMAIN="https://ntfy.sh"
|
||||
# NTFY_TOPIC_NAME="YourUniqueTopicName"
|
||||
# NTFY_AUTH="" # set to either format -> "user:password" OR ":tk_12345678". If using tokens, don't forget the ":"
|
||||
#
|
||||
# PUSHBULLET_URL="https://api.pushbullet.com/v2/pushes"
|
||||
# PUSHBULLET_TOKEN="token-value"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
|
||||
NOTIFY_NTFYSH_VERSION="v0.5"
|
||||
NOTIFY_NTFYSH_VERSION="v0.6"
|
||||
#
|
||||
# Setup app and subscription at https://ntfy.sh
|
||||
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
|
||||
|
|
@ -24,11 +24,18 @@ trigger_ntfy_notification() {
|
|||
ContentType="Markdown: no" #text/plain
|
||||
fi
|
||||
|
||||
if [[ -n "${NTFY_AUTH:-}" ]]; then
|
||||
NtfyAuth="-u $NTFY_AUTH"
|
||||
else
|
||||
NtfyAuth=""
|
||||
fi
|
||||
|
||||
curl -S -o /dev/null ${CurlArgs} \
|
||||
-H "Title: $MessageTitle" \
|
||||
-H "$ContentType" \
|
||||
-d "$MessageBody" \
|
||||
"$NtfyUrl"
|
||||
$NtfyAuth \
|
||||
-L "$NtfyUrl"
|
||||
|
||||
if [[ $? -gt 0 ]]; then
|
||||
NotifyError=true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue