Add file notification channel (#222)

* Add file notification channel

* Bypass file channel notifications for dockcheck.sh script

* Implement notification channel template reuse and advanced configuration variables.

* Fix text insertion formatting for dockcheck script and container updates.

* Fix dockcheck.sh notification csv and text output.

* Fix ntfy variable references and replace tr for uppercase conversion.

* Fix ALLOWEMPTY logic, undefined snippet case, and README formatting.

* Refactor notification send/skip logic. Adjust missing variable return codes.

* Adjust notifications README section for clarity and readability.

---------

Co-authored-by: Matthew Oleksowicz <matt@everyoneneeds.it>
This commit is contained in:
vorezal 2025-09-15 05:25:23 -04:00 committed by GitHub
parent 37f33d7a06
commit 31a45f1d84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 620 additions and 267 deletions

View file

@ -0,0 +1,22 @@
### DISCLAIMER: This is a third party addition to dockcheck - best effort testing.
NOTIFY_FILE_VERSION="v0.1"
#
# Leave (or place) this file in the "notify_templates" subdirectory within the same directory as the main dockcheck.sh script.
# If you instead wish make your own modifications, make a copy in the same directory as the main dockcheck.sh script.
trigger_file_notification() {
if [[ -n "$1" ]]; then
file_channel="$1"
UpperChannel=$(tr '[:lower:]' '[:upper:]' <<< "$file_channel")
else
file_channel="file"
UpperChannel="FILE"
fi
FilePathVar="${UpperChannel}_PATH"
NotifyFile="${!FilePathVar:=${ScriptWorkDir}/updates_available.txt}"
echo "${MessageBody}" > ${NotifyFile}
}