Skip to content

Commit

Permalink
allow 0 days retention period
Browse files Browse the repository at this point in the history
  • Loading branch information
rafsaf committed Aug 27, 2023
1 parent c622b04 commit 7bbb605
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion backuper/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Settings(BaseSettings):
SIGTERM_TIMEOUT_SECS: float = Field(ge=0, le=3600 * 24, default=30)
ZIP_ARCHIVE_LEVEL: int = Field(ge=1, le=9, default=3)
BACKUP_MAX_NUMBER: int = Field(ge=1, le=998, default=7)
BACKUP_MIN_RETENTION_DAYS: int = Field(ge=1, le=36600, default=3)
BACKUP_MIN_RETENTION_DAYS: int = Field(ge=0, le=36600, default=3)
DISCORD_SUCCESS_WEBHOOK_URL: HttpUrl | None = None
DISCORD_FAIL_WEBHOOK_URL: HttpUrl | None = None
DISCORD_NOTIFICATION_MAX_MSG_LEN: int = Field(ge=150, le=10000, default=1500)
Expand Down
2 changes: 1 addition & 1 deletion backuper/models/backup_target_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class TargetModel(BaseModel):
cron_rule: str
max_backups: int = Field(ge=1, le=998, default=config.options.BACKUP_MAX_NUMBER)
min_retention_days: int = Field(
ge=1, le=36600, default=config.options.BACKUP_MIN_RETENTION_DAYS
ge=0, le=36600, default=config.options.BACKUP_MIN_RETENTION_DAYS
)

@field_validator("cron_rule")
Expand Down
2 changes: 1 addition & 1 deletion docs/backup_targets/directory.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ DIRECTORY_SOME_STRING="abs_path=... cron_rule=..."
| abs_path | string[**requried**] | Absolute path to folder for backup. | - |
| cron_rule | string[**requried**] | Cron expression for backups, see [https://crontab.guru/](https://crontab.guru/) for help. | - |
| max_backups | int | Soft limit how many backups can live at once for backup target. Defaults to `7`. This must makes sense with cron expression you use. For example if you want to have `7` day retention, and make backups at 5:00, `max_backups=7` is fine, but if you make `4` backups per day, you would need `max_backups=28`. Limit is soft and can be exceeded if no backup is older than value specified in min_retention_days. Min `1` and max `998`. Defaults to enviornment variable BACKUP_MAX_NUMBER, see [Configuration](./../configuration.md). | BACKUP_MAX_NUMBER |
| min_retention_days | int | Hard minimum backups lifetime in days. Backuper won't ever delete files before, regardles of other options. Min `1` and max `36600`. Defaults to enviornment variable BACKUP_MIN_RETENTION_DAYS, see [Configuration](./../configuration.md). | BACKUP_MIN_RETENTION_DAYS |
| min_retention_days | int | Hard minimum backups lifetime in days. Backuper won't ever delete files before, regardles of other options. Min `0` and max `36600`. Defaults to enviornment variable BACKUP_MIN_RETENTION_DAYS, see [Configuration](./../configuration.md). | BACKUP_MIN_RETENTION_DAYS |


## Examples
Expand Down
2 changes: 1 addition & 1 deletion docs/backup_targets/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SINGLEFILE_SOME_STRING="abs_path=... cron_rule=..."
| abs_path | string[**requried**] | Absolute path to file for backup. | - |
| cron_rule | string[**requried**] | Cron expression for backups, see [https://crontab.guru/](https://crontab.guru/) for help. | - |
| max_backups | int | Soft limit how many backups can live at once for backup target. Defaults to `7`. This must makes sense with cron expression you use. For example if you want to have `7` day retention, and make backups at 5:00, `max_backups=7` is fine, but if you make `4` backups per day, you would need `max_backups=28`. Limit is soft and can be exceeded if no backup is older than value specified in min_retention_days. Min `1` and max `998`. Defaults to enviornment variable BACKUP_MAX_NUMBER, see [Configuration](./../configuration.md). | BACKUP_MAX_NUMBER |
| min_retention_days | int | Hard minimum backups lifetime in days. Backuper won't ever delete files before, regardles of other options. Min `1` and max `36600`. Defaults to enviornment variable BACKUP_MIN_RETENTION_DAYS, see [Configuration](./../configuration.md). | BACKUP_MIN_RETENTION_DAYS |
| min_retention_days | int | Hard minimum backups lifetime in days. Backuper won't ever delete files before, regardles of other options. Min `0` and max `36600`. Defaults to enviornment variable BACKUP_MIN_RETENTION_DAYS, see [Configuration](./../configuration.md). | BACKUP_MIN_RETENTION_DAYS |

## Examples

Expand Down
2 changes: 1 addition & 1 deletion docs/backup_targets/mariadb.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ MARIADB_SOME_STRING="host=... password=... cron_rule=..."
| port | int | Mariadb database port. | 3306 |
| db | string | Mariadb database name. | mariadb |
| max_backups | int | Soft limit how many backups can live at once for backup target. Defaults to `7`. This must makes sense with cron expression you use. For example if you want to have `7` day retention, and make backups at 5:00, `max_backups=7` is fine, but if you make `4` backups per day, you would need `max_backups=28`. Limit is soft and can be exceeded if no backup is older than value specified in min_retention_days. Min `1` and max `998`. Defaults to enviornment variable BACKUP_MAX_NUMBER, see [Configuration](./../configuration.md). | BACKUP_MAX_NUMBER |
| min_retention_days | int | Hard minimum backups lifetime in days. Backuper won't ever delete files before, regardles of other options. Min `1` and max `36600`. Defaults to enviornment variable BACKUP_MIN_RETENTION_DAYS, see [Configuration](./../configuration.md). | BACKUP_MIN_RETENTION_DAYS |
| min_retention_days | int | Hard minimum backups lifetime in days. Backuper won't ever delete files before, regardles of other options. Min `0` and max `36600`. Defaults to enviornment variable BACKUP_MIN_RETENTION_DAYS, see [Configuration](./../configuration.md). | BACKUP_MIN_RETENTION_DAYS |

## Examples

Expand Down
2 changes: 1 addition & 1 deletion docs/backup_targets/mysql.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ MYSQL_SOME_STRING="host=... password=... cron_rule=..."
| port | int | MySQL database port. | 3306 |
| db | string | MySQL database name. | mysql |
| max_backups | int | Soft limit how many backups can live at once for backup target. Defaults to `7`. This must makes sense with cron expression you use. For example if you want to have `7` day retention, and make backups at 5:00, `max_backups=7` is fine, but if you make `4` backups per day, you would need `max_backups=28`. Limit is soft and can be exceeded if no backup is older than value specified in min_retention_days. Min `1` and max `998`. Defaults to enviornment variable BACKUP_MAX_NUMBER, see [Configuration](./../configuration.md). | BACKUP_MAX_NUMBER |
| min_retention_days | int | Hard minimum backups lifetime in days. Backuper won't ever delete files before, regardles of other options. Min `1` and max `36600`. Defaults to enviornment variable BACKUP_MIN_RETENTION_DAYS, see [Configuration](./../configuration.md). | BACKUP_MIN_RETENTION_DAYS |
| min_retention_days | int | Hard minimum backups lifetime in days. Backuper won't ever delete files before, regardles of other options. Min `0` and max `36600`. Defaults to enviornment variable BACKUP_MIN_RETENTION_DAYS, see [Configuration](./../configuration.md). | BACKUP_MIN_RETENTION_DAYS |

## Examples

Expand Down
2 changes: 1 addition & 1 deletion docs/backup_targets/postgresql.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ POSTGRESQL_SOME_STRING="host=... password=... cron_rule=..."
| port | int | PostgreSQL database port. | 5432 |
| db | string | PostgreSQL database name. | postgres |
| max_backups | int | Soft limit how many backups can live at once for backup target. Defaults to `7`. This must makes sense with cron expression you use. For example if you want to have `7` day retention, and make backups at 5:00, `max_backups=7` is fine, but if you make `4` backups per day, you would need `max_backups=28`. Limit is soft and can be exceeded if no backup is older than value specified in min_retention_days. Min `1` and max `998`. Defaults to enviornment variable BACKUP_MAX_NUMBER, see [Configuration](./../configuration.md). | BACKUP_MAX_NUMBER |
| min_retention_days | int | Hard minimum backups lifetime in days. Backuper won't ever delete files before, regardles of other options. Min `1` and max `36600`. Defaults to enviornment variable BACKUP_MIN_RETENTION_DAYS, see [Configuration](./../configuration.md). | BACKUP_MIN_RETENTION_DAYS |
| min_retention_days | int | Hard minimum backups lifetime in days. Backuper won't ever delete files before, regardles of other options. Min `0` and max `36600`. Defaults to enviornment variable BACKUP_MIN_RETENTION_DAYS, see [Configuration](./../configuration.md). | BACKUP_MIN_RETENTION_DAYS |

## Examples

Expand Down
Loading

0 comments on commit 7bbb605

Please sign in to comment.