feat: make gotify optional #16

Merged
t.behrendt merged 2 commits from feat-make-gotify-optional into main 2025-09-04 20:18:25 +02:00
Showing only changes of commit 164c9ac01c - Show all commits

View File

@@ -1,6 +1,20 @@
#!/bin/bash #!/bin/bash
set -euo pipefail set -euo pipefail
#######################################
# Date format for logging.
#######################################
LOG_DATE_FORMAT="%Y-%m-%dT%T"
#######################################
# Log a message with a timestamp.
# Arguments:
# Message to log.
#######################################
log() {
echo "$(date +"$LOG_DATE_FORMAT") - $*"
}
####################################### #######################################
# Determine backup mode from the environment only. # Determine backup mode from the environment only.
# Valid values: "directory" or "postgres". # Valid values: "directory" or "postgres".
@@ -18,7 +32,7 @@ fi
for cmd in "${REQUIRED_CMDS[@]}"; do for cmd in "${REQUIRED_CMDS[@]}"; do
if ! command -v "$cmd" &>/dev/null; then if ! command -v "$cmd" &>/dev/null; then
echo "Error: Required command '$cmd' is not installed." >&2 log "Error: Required command '$cmd' is not installed."
exit 1 exit 1
fi fi
done done
@@ -75,20 +89,6 @@ if [ "$ENABLE_GOTIFY" = "true" ]; then
GOTIFYURL="${GOTIFYHOST}/message?token=${GOTIFYTOKEN}" GOTIFYURL="${GOTIFYHOST}/message?token=${GOTIFYTOKEN}"
fi fi
#######################################
# Date format for logging.
#######################################
LOG_DATE_FORMAT="%Y-%m-%dT%T"
#######################################
# Log a message with a timestamp.
# Arguments:
# Message to log.
#######################################
log() {
echo "$(date +"$LOG_DATE_FORMAT") - $*"
}
####################################### #######################################
# Send a notification via Gotify. # Send a notification via Gotify.
# Arguments: # Arguments: