mirror of
https://github.com/mag37/dockcheck.git
synced 2026-02-14 15:28:22 +01:00
Fix ntfy variable references and replace tr for uppercase conversion.
This commit is contained in:
parent
009dfb9e44
commit
8bbc73482e
13 changed files with 31 additions and 31 deletions
|
|
@ -25,12 +25,12 @@ fi
|
|||
trigger_DSM_notification() {
|
||||
if [[ -n "$1" ]]; then
|
||||
DSM_channel="$1"
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$DSM_channel")
|
||||
else
|
||||
DSM_channel="DSM"
|
||||
UpperChannel="DSM"
|
||||
fi
|
||||
|
||||
UpperChannel="${DSM_channel^^}"
|
||||
|
||||
DSMSendmailToVar="${UpperChannel}_SENDMAILTO"
|
||||
DSMSubjectTagVar="${UpperChannel}_SUBJECTTAG"
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ NOTIFY_HA_VERSION="v0.2"
|
|||
trigger_HA_notification() {
|
||||
if [[ -n "$1" ]]; then
|
||||
HA_channel="$1"
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$HA_channel")
|
||||
else
|
||||
HA_channel="HA"
|
||||
UpperChannel="HA"
|
||||
fi
|
||||
|
||||
UpperChannel="${HA_channel^^}"
|
||||
|
||||
HAEntityVar="${UpperChannel}_ENTITY"
|
||||
HAUrlVar="${UpperChannel}_URL"
|
||||
HATokenVar="${UpperChannel}_TOKEN"
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ NOTIFY_APPRISE_VERSION="v0.4"
|
|||
trigger_apprise_notification() {
|
||||
if [[ -n "$1" ]]; then
|
||||
apprise_channel="$1"
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$apprise_channel")
|
||||
else
|
||||
apprise_channel="apprise"
|
||||
UpperChannel="APPRISE"
|
||||
fi
|
||||
|
||||
UpperChannel="${apprise_channel^^}"
|
||||
|
||||
ApprisePayloadVar="${UpperChannel}_PAYLOAD"
|
||||
AppriseUrlVar="${UpperChannel}_URL"
|
||||
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ NOTIFY_DISCORD_VERSION="v0.5"
|
|||
trigger_discord_notification() {
|
||||
if [[ -n "$1" ]]; then
|
||||
discord_channel="$1"
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$discord_channel")
|
||||
else
|
||||
discord_channel="discord"
|
||||
UpperChannel="DISCORD"
|
||||
fi
|
||||
|
||||
UpperChannel="${discord_channel^^}"
|
||||
|
||||
DiscordWebhookUrlVar="${UpperChannel}_WEBHOOK_URL"
|
||||
|
||||
if [[ -z "${!DiscordWebhookUrlVar:-}" ]]; then
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ NOTIFY_GOTIFY_VERSION="v0.5"
|
|||
trigger_gotify_notification() {
|
||||
if [[ -n "$1" ]]; then
|
||||
gotify_channel="$1"
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$gotify_channel")
|
||||
else
|
||||
gotify_channel="gotify"
|
||||
UpperChannel="GOTIFY"
|
||||
fi
|
||||
|
||||
UpperChannel="${gotify_channel^^}"
|
||||
|
||||
GotifyTokenVar="${UpperChannel}_TOKEN"
|
||||
GotifyUrlVar="${UpperChannel}_DOMAIN"
|
||||
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ NOTIFY_MATRIX_VERSION="v0.4"
|
|||
trigger_matrix_notification() {
|
||||
if [[ -n "$1" ]]; then
|
||||
matrix_channel="$1"
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$matrix_channel")
|
||||
else
|
||||
matrix_channel="matrix"
|
||||
UpperChannel="MATRIX"
|
||||
fi
|
||||
|
||||
UpperChannel="${matrix_channel^^}"
|
||||
|
||||
AccessTokenVar="${UpperChannel}_ACCESS_TOKEN"
|
||||
RoomIdVar="${UpperChannel}_ROOM_ID"
|
||||
MatrixServerVar="${UpperChannel}_SERVER_URL"
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@ NOTIFY_NTFYSH_VERSION="v0.7"
|
|||
trigger_ntfy_notification() {
|
||||
if [[ -n "$1" ]]; then
|
||||
ntfy_channel="$1"
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$ntfy_channel")
|
||||
else
|
||||
ntfy_channel="ntfy"
|
||||
UpperChannel="NTFY"
|
||||
fi
|
||||
|
||||
UpperChannel="${ntfy_channel^^}"
|
||||
|
||||
NtfyDomainVar="${UpperChannel}_DOMAIN"
|
||||
NtfyTopicNameVar="${UpperChannel}_TOPIC_NAME"
|
||||
NtfyAuthVar="${UpperChannel}_AUTH"
|
||||
|
||||
if [[ -z "${!GotifyTokenVar:-}" ]] || [[ -z "${!GotifyUrlVar:-}" ]]; then
|
||||
if [[ -z "${!NtfyDomainVar:-}" ]] || [[ -z "${!NtfyTopicNameVar:-}" ]]; then
|
||||
printf "The ${ntfy_channel} notification channel is enabled, but required configuration variables are missing. Ntfy notifications will not be sent.\n"
|
||||
|
||||
remove_channel ntfy
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ NOTIFY_PUSHBULLET_VERSION="v0.4"
|
|||
trigger_pushbullet_notification() {
|
||||
if [[ -n "$1" ]]; then
|
||||
pushbullet_channel="$1"
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$pushbullet_channel")
|
||||
else
|
||||
pushbullet_channel="pushbullet"
|
||||
UpperChannel="PUSHBULLET"
|
||||
fi
|
||||
|
||||
UpperChannel="${pushbullet_channel^^}"
|
||||
|
||||
PushUrlVar="${UpperChannel}_URL"
|
||||
PushTokenVar="${UpperChannel}_TOKEN"
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ NOTIFY_PUSHOVER_VERSION="v0.4"
|
|||
trigger_pushover_notification() {
|
||||
if [[ -n "$1" ]]; then
|
||||
pushover_channel="$1"
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$pushover_channel")
|
||||
else
|
||||
pushover_channel="pushover"
|
||||
UpperChannel="PUSHOVER"
|
||||
fi
|
||||
|
||||
UpperChannel="${pushover_channel^^}"
|
||||
|
||||
PushoverUrlVar="${UpperChannel}_URL"
|
||||
PushoverUserKeyVar="${UpperChannel}_USER_KEY"
|
||||
PushoverTokenVar="${UpperChannel}_TOKEN"
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ NOTIFY_SLACK_VERSION="v0.4"
|
|||
trigger_slack_notification() {
|
||||
if [[ -n "$1" ]]; then
|
||||
slack_channel="$1"
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$slack_channel")
|
||||
else
|
||||
slack_channel="slack"
|
||||
UpperChannel="SLACK"
|
||||
fi
|
||||
|
||||
UpperChannel="${slack_channel^^}"
|
||||
|
||||
AccessTokenVar="${UpperChannel}_ACCESS_TOKEN"
|
||||
ChannelIDVar="${UpperChannel}_CHANNEL_ID"
|
||||
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ fi
|
|||
trigger_smtp_notification() {
|
||||
if [[ -n "$1" ]]; then
|
||||
smtp_channel="$1"
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$smtp_channel")
|
||||
else
|
||||
smtp_channel="smtp"
|
||||
UpperChannel="SMTP"
|
||||
fi
|
||||
|
||||
UpperChannel="${smtp_channel^^}"
|
||||
|
||||
SendMailFromVar="${UpperChannel}_MAIL_FROM"
|
||||
SendMailToVar="${UpperChannel}_MAIL_TO"
|
||||
SubjectTagVar="${UpperChannel}_SUBJECT_TAG"
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ NOTIFY_TELEGRAM_VERSION="v0.5"
|
|||
trigger_telegram_notification() {
|
||||
if [[ -n "$1" ]]; then
|
||||
telegram_channel="$1"
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$telegram_channel")
|
||||
else
|
||||
telegram_channel="telegram"
|
||||
UpperChannel="TELEGRAM"
|
||||
fi
|
||||
|
||||
UpperChannel="${telegram_channel^^}"
|
||||
|
||||
TelegramTokenVar="${UpperChannel}_TOKEN"
|
||||
TelegramChatIdVar="${UpperChannel}_CHAT_ID"
|
||||
TelegramTopicIdVar="${UpperChannel}_TOPIC_ID"
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ UpdToString=""
|
|||
FormattedOutput=""
|
||||
|
||||
get_channel_template() {
|
||||
local UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$1")
|
||||
local UpperChannel="${1^^}"
|
||||
local TemplateVar="${UpperChannel}_TEMPLATE"
|
||||
if [[ -n "${!TemplateVar:-}" ]]; then
|
||||
printf "${!TemplateVar}"
|
||||
|
|
@ -54,7 +54,7 @@ for template in "${enabled_notify_templates[@]}"; do
|
|||
done
|
||||
|
||||
skip_snooze() {
|
||||
local UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$1")
|
||||
local UpperChannel="${1^^}"
|
||||
local SkipSnoozeVar="${UpperChannel}_SKIPSNOOZE"
|
||||
if [[ "${!SkipSnoozeVar:-}" == "true" ]]; then
|
||||
printf "true"
|
||||
|
|
@ -64,7 +64,7 @@ skip_snooze() {
|
|||
}
|
||||
|
||||
allow_empty() {
|
||||
local UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$1")
|
||||
local UpperChannel="${1^^}"
|
||||
local AllowEmptyVar="${UpperChannel}_ALLOWEMPTY"
|
||||
if [[ "${!AllowEmptyVar:-}" == "true" ]]; then
|
||||
printf "true"
|
||||
|
|
@ -74,7 +74,7 @@ allow_empty() {
|
|||
}
|
||||
|
||||
containers_only() {
|
||||
local UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$1")
|
||||
local UpperChannel="${1^^}"
|
||||
local ContainersOnlyVar="${UpperChannel}_CONTAINERSONLY"
|
||||
if [[ "${!ContainersOnlyVar:-}" == "true" ]]; then
|
||||
printf "true"
|
||||
|
|
@ -84,7 +84,7 @@ containers_only() {
|
|||
}
|
||||
|
||||
output_format() {
|
||||
local UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$1")
|
||||
local UpperChannel="${1^^}"
|
||||
local OutputFormatVar="${UpperChannel}_OUTPUT"
|
||||
if [[ -z "${!OutputFormatVar:-}" ]]; then
|
||||
printf "text"
|
||||
|
|
@ -318,7 +318,7 @@ notify_update_notification() {
|
|||
UpdateChannels=( "${enabled_notify_templates[@]}" "v2" )
|
||||
|
||||
for NotifyScript in "${UpdateChannels[@]}"; do
|
||||
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$NotifyScript")
|
||||
UpperChannel="${NotifyScript^^}"
|
||||
VersionVar="NOTIFY_${UpperChannel}_VERSION"
|
||||
if [[ -n "${!VersionVar:-}" ]]; then
|
||||
RawNotifyUrl="https://raw.githubusercontent.com/mag37/dockcheck/main/notify_templates/notify_${NotifyScript}.sh"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue