feat: Add Telegram notification

This commit is contained in:
Jonas Kaninda
2024-09-10 22:59:28 +02:00
parent 90fd4642f2
commit 13ea6194d3
22 changed files with 229 additions and 32 deletions

View File

@@ -1,7 +1,9 @@
// Package pkg /*
/*
Copyright © 2024 Jonas Kaninda
*/
// Package pkg /
/*****
@author Jonas Kaninda
@license MIT License <https://opensource.org/licenses/MIT>
@Copyright © 2024 Jonas Kaninda
**/
package pkg
import (
@@ -17,6 +19,7 @@ import (
)
func StartBackup(cmd *cobra.Command) {
utils.Welcome()
//Set env
utils.SetEnv("STORAGE_PATH", storagePath)
utils.GetEnv(cmd, "period", "BACKUP_CRON_EXPRESSION")
@@ -198,6 +201,8 @@ func localBackup(db *dbConfig, backupFileName string, disableCompression bool, p
}
utils.Info("Backup name is %s", finalFileName)
moveToBackup(finalFileName, storagePath)
//Send notification
utils.NotifySuccess(finalFileName)
//Delete old backup
if prune {
deleteOldBackup(backupRetention)
@@ -240,6 +245,8 @@ func s3Backup(db *dbConfig, backupFileName string, disableCompression bool, prun
}
}
utils.Done("Uploading backup archive to remote storage S3 ... done ")
//Send notification
utils.NotifySuccess(finalFileName)
//Delete temp
deleteTemp()
}
@@ -273,6 +280,8 @@ func sshBackup(db *dbConfig, backupFileName, remotePath string, disableCompressi
}
utils.Done("Uploading backup archive to remote storage ... done ")
//Send notification
utils.NotifySuccess(finalFileName)
//Delete temp
deleteTemp()
}