feat-backup-classes #2
@@ -16,6 +16,14 @@ from typing import Dict, List, Optional
|
|||||||
import requests
|
import requests
|
||||||
import tomllib
|
import tomllib
|
||||||
|
|
||||||
|
CONFIG_PATH = Path("/etc/backup/config.toml")
|
||||||
|
|
||||||
|
# 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"
|
||||||
|
|
||||||
# Configure logging
|
# Configure logging
|
||||||
logging.basicConfig(
|
logging.basicConfig(
|
||||||
@@ -54,6 +62,12 @@ class Config:
|
|||||||
notifications: Dict[str, TelegramConfig]
|
notifications: Dict[str, TelegramConfig]
|
||||||
|
|
||||||
|
|
||||||
|
@dataclass
|
||||||
|
class Application:
|
||||||
|
path: Path
|
||||||
|
owner: str
|
||||||
|
|
||||||
|
|
||||||
class ResticStorage:
|
class ResticStorage:
|
||||||
def __init__(self, cfg: StorageConfig):
|
def __init__(self, cfg: StorageConfig):
|
||||||
if cfg.type != "restic":
|
if cfg.type != "restic":
|
||||||
@@ -130,22 +144,6 @@ class ResticStorage:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
CONFIG_PATH = Path("/etc/backup/config.toml")
|
|
||||||
|
|
||||||
# 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"
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class Application:
|
|
||||||
path: Path
|
|
||||||
owner: str
|
|
||||||
|
|
||||||
|
|
||||||
class BackupManager:
|
class BackupManager:
|
||||||
def __init__(self, config: Config, storage: ResticStorage):
|
def __init__(self, config: Config, storage: ResticStorage):
|
||||||
self.errors: List[str] = []
|
self.errors: List[str] = []
|
||||||
|
|||||||
Reference in New Issue
Block a user