feat: enable feature flag for notifications

default to not sending notifications, override in the env
This commit is contained in:
Alex Kelly 2023-01-17 10:39:41 -05:00
parent f509e68ef5
commit 32409b9891
2 changed files with 9 additions and 1 deletions

View file

@ -10,6 +10,7 @@ BACKUP_EXCLUDES="/etc/restic/exclude"
BACKUP_TAG=$(hostname -s) BACKUP_TAG=$(hostname -s)
FEAT_NOTIFY=false
# How many backups to keep. # How many backups to keep.
RETENTION_DAYS=7 RETENTION_DAYS=7
@ -96,12 +97,16 @@ notify () {
fi fi
# call whatever notification script/function you wish with "$message" as the part you want to show # call whatever notification script/function you wish with "$message" as the part you want to show
send_matrix "$message" if $FEAT_NOTIFY; then
send_matrix "$message"
fi
} }
# Do the actual work # Do the actual work
ERRORS="" ERRORS=""
STATUS_TOTAL=0 STATUS_TOTAL=0
echo "testing"|notify
exit 1
if run_checklock; then if run_checklock; then
${ECHO} "Restic backup on $HOST starting at $(timestamp)"|notify ${ECHO} "Restic backup on $HOST starting at $(timestamp)"|notify

View file

@ -9,6 +9,9 @@ export RESTIC_REPOSITORY=
# restic cache dir # restic cache dir
export RESTIC_CACHE_DIR= export RESTIC_CACHE_DIR=
# Uncomment the next line to ENABLE notifications
#export FEAT_NOTIFY=true
## matrix notifiction hook settings ## matrix notifiction hook settings
# base url for matrix hook # base url for matrix hook
export MATRIX_HOOK_URL= export MATRIX_HOOK_URL=