Add per-job backup retention

This commit is contained in:
Mikei386
2026-06-14 13:27:25 +02:00
parent 7e2c604c5f
commit 4f76d86b9e
13 changed files with 83 additions and 14 deletions
+4 -1
View File
@@ -87,9 +87,12 @@ func ValidateJob(j Job) error {
if j.Consistency.Mode != "live" && j.Consistency.Mode != "stop" {
return errors.New("consistency mode must be live or stop")
}
if j.Retention.Daily < 0 || j.Retention.Weekly < 0 || j.Retention.Monthly < 0 {
if j.Retention.KeepWithinDays < 0 || j.Retention.Daily < 0 || j.Retention.Weekly < 0 || j.Retention.Monthly < 0 {
return errors.New("retention values cannot be negative")
}
if j.Retention.KeepWithinDays == 0 && j.Retention.Daily == 0 && j.Retention.Weekly == 0 && j.Retention.Monthly == 0 {
return errors.New("retention must keep at least one age or calendar policy")
}
for _, exclude := range j.Excludes {
if strings.ContainsAny(exclude, "\x00\r\n") {
return errors.New("exclude contains forbidden control characters")