chore: replace prune and keep-last flags by BACKUP_RETENTION_DAYS env variable

This commit is contained in:
Jonas Kaninda
2024-10-19 05:30:57 +02:00
parent 56c271bc29
commit 3f7d28ea49
2 changed files with 5 additions and 4 deletions

View File

@@ -177,8 +177,11 @@ func initBackupConfig(cmd *cobra.Command) *BackupConfig {
//Get flag value and set env
remotePath := utils.GetEnvVariable("REMOTE_PATH", "SSH_REMOTE_PATH")
storage = utils.GetEnv(cmd, "storage", "STORAGE")
backupRetention, _ := cmd.Flags().GetInt("keep-last")
prune, _ := cmd.Flags().GetBool("prune")
prune := false
backupRetention := utils.GetIntEnv("BACKUP_RETENTION_DAYS")
if backupRetention > 0 {
prune = true
}
disableCompression, _ = cmd.Flags().GetBool("disable-compression")
_, _ = cmd.Flags().GetString("mode")
passphrase := os.Getenv("GPG_PASSPHRASE")