Backups: use constants for file names

This commit is contained in:
2025-12-20 10:36:19 +03:00
parent 11e5b5752e
commit 479e256b1e

View File

@@ -39,6 +39,13 @@ TELEGRAM_BOT_TOKEN = config.get("telegram", "TELEGRAM_BOT_TOKEN")
TELEGRAM_CHAT_ID = config.get("telegram", "TELEGRAM_CHAT_ID")
NOTIFICATIONS_NAME = config.get("telegram", "NOTIFICATIONS_NAME")
# File name to store directories and files to back up
BACKUP_TARGETS_FILE = "backup-targets"
# Default directory fo backups (relative to app dir)
# Used when backup-targets file not exists
BACKUP_DEFAULT_DIR = "backups"
class BackupManager:
def __init__(self):
@@ -146,7 +153,7 @@ class BackupManager:
for app_dir_str, _ in app_dirs:
app_dir = Path(app_dir_str)
targets_file = app_dir / "backup-targets"
targets_file = app_dir / BACKUP_TARGETS_FILE
resolved_targets: List[Path] = []
if targets_file.exists():
@@ -167,7 +174,7 @@ class BackupManager:
self.warnings.append(warning_msg)
else:
# Fallback to default backups directory when no list is provided.
default_target = (app_dir / "backups").resolve()
default_target = (app_dir / BACKUP_DEFAULT_DIR).resolve()
if default_target.exists():
resolved_targets.append(default_target)
else: