Revert "feat: make gotify optional (#14)"
All checks were successful
CD / Check changes (push) Successful in 7s
CD / Create tag (push) Successful in 17s
CD / Build and push (amd64) (push) Successful in 28s
CD / Build and push (arm64) (push) Successful in 1m23s
CD / Create manifest (push) Successful in 11s

This reverts commit cd92ce697e.
This commit is contained in:
2025-09-04 20:03:40 +02:00
parent cd92ce697e
commit 0c0305301e
2 changed files with 11 additions and 37 deletions

View File

@@ -26,17 +26,10 @@ done
#######################################
# Validate common required environment variables.
#######################################
# Gotify notification settings (optional).
# Set ENABLE_GOTIFY to "true" to enable notifications, any other value or unset disables them.
ENABLE_GOTIFY="${ENABLE_GOTIFY:-true}"
if [ "$ENABLE_GOTIFY" = "true" ]; then
: "${GOTIFYHOST:?Environment variable GOTIFYHOST is not set (required when ENABLE_GOTIFY=true)}"
: "${GOTIFYTOKEN:?Environment variable GOTIFYTOKEN is not set (required when ENABLE_GOTIFY=true)}"
: "${GOTIFYTOPIC:?Environment variable GOTIFYTOPIC is not set (required when ENABLE_GOTIFY=true)}"
else
log "Gotify notifications disabled. Backup status will be logged to console only."
fi
# Gotify notification settings.
: "${GOTIFYHOST:?Environment variable GOTIFYHOST is not set}"
: "${GOTIFYTOKEN:?Environment variable GOTIFYTOKEN is not set}"
: "${GOTIFYTOPIC:?Environment variable GOTIFYTOPIC is not set}"
# Restic encryption password.
: "${RESTIC_PASSWORD:?Environment variable RESTIC_PASSWORD is not set}"
@@ -69,11 +62,9 @@ case "$BACKUP_MODE" in
esac
#######################################
# Build the Gotify URL (only if Gotify is enabled).
# Build the Gotify URL.
#######################################
if [ "$ENABLE_GOTIFY" = "true" ]; then
GOTIFYURL="${GOTIFYHOST}/message?token=${GOTIFYTOKEN}"
fi
GOTIFYURL="${GOTIFYHOST}/message?token=${GOTIFYTOKEN}"
#######################################
# Date format for logging.
@@ -96,13 +87,6 @@ log() {
#######################################
send_notification() {
local message="$1"
# Only send notification if Gotify is enabled
if [ "$ENABLE_GOTIFY" != "true" ]; then
log "$message"
return 0
fi
if ! curl -s -X POST "$GOTIFYURL" -F "title=${GOTIFYTOPIC}" -F "message=${message}" >/dev/null; then
log "Warning: Failed to send notification with message: ${message}"
fi