diff --git a/backuper/config.py b/backuper/config.py index 713b635..7726440 100644 --- a/backuper/config.py +++ b/backuper/config.py @@ -32,30 +32,22 @@ class BackupTargetEnum(StrEnum): CONST_ZIP_BIN_7ZZ_PATH: Path = BASE_DIR / "bin/7zz" CONST_BACKUP_FOLDER_PATH: Path = BASE_DIR / "data" CONST_GOOGLE_SERVICE_ACCOUNT_PATH: Path = BASE_DIR / "google_auth.json" -CONST_GOOGLE_SERVICE_ACCOUNT_PATH.touch(mode=0o700, exist_ok=True) CONST_BACKUP_FOLDER_PATH.mkdir(mode=0o744, parents=True, exist_ok=True) -LOG_FOLDER_PATH: Path = Path( - os.environ.get("BACKUPER_LOG_FOLDER_PATH", BASE_DIR / "logs") -) +LOG_FOLDER_PATH: Path = Path(os.environ.get("LOG_FOLDER_PATH", BASE_DIR / "logs")) LOG_FOLDER_PATH.mkdir(mode=0o700, parents=True, exist_ok=True) -LOG_LEVEL = os.environ.get("BACKUPER_LOG_LEVEL", "INFO") -BACKUP_PROVIDER = os.environ.get("BACKUPER_PROVIDER", "") -ZIP_ARCHIVE_PASSWORD = os.environ.get("BACKUPER_ZIP_PASSWORD", "") -SUBPROCESS_TIMEOUT_SECS: int = int( - os.environ.get("BACKUPER_SUBPROCESS_TIMEOUT_SECS", 60 * 60) -) -SIGTERM_TIMEOUT_SECS: float = float(os.environ.get("BACKUPER_SIGTERM_TIMEOUT_SECS", 30)) -ZIP_ARCHIVE_LEVEL: int = int(os.environ.get("BACKUPER_ZIP_ARCHIVE_LEVEL", 3)) -BACKUP_MAX_NUMBER: int = int(os.environ.get("BACKUPER_BACKUPS_MAX_NUMBER", 7)) -DISCORD_SUCCESS_WEBHOOK_URL: str = os.environ.get( - "BACKUPER_DISCORD_SUCCESS_WEBHOOK_URL", "" -) -DISCORD_FAIL_WEBHOOK_URL: str = os.environ.get("BACKUPER_DISCORD_FAIL_WEBHOOK_URL", "") +LOG_LEVEL = os.environ.get("LOG_LEVEL", "INFO") +BACKUP_PROVIDER = os.environ.get("BACKUP_PROVIDER", "") +ZIP_ARCHIVE_PASSWORD = os.environ.get("ZIP_ARCHIVE_PASSWORD", "") +SUBPROCESS_TIMEOUT_SECS: int = int(os.environ.get("SUBPROCESS_TIMEOUT_SECS", 60 * 60)) +SIGTERM_TIMEOUT_SECS: float = float(os.environ.get("SIGTERM_TIMEOUT_SECS", 30)) +ZIP_ARCHIVE_LEVEL: int = int(os.environ.get("ZIP_ARCHIVE_LEVEL", 3)) +BACKUP_MAX_NUMBER: int = int(os.environ.get("BACKUP_MAX_NUMBER", 7)) +DISCORD_SUCCESS_WEBHOOK_URL: str = os.environ.get("DISCORD_SUCCESS_WEBHOOK_URL", "") +DISCORD_FAIL_WEBHOOK_URL: str = os.environ.get("DISCORD_FAIL_WEBHOOK_URL", "") -if ZIP_ARCHIVE_PASSWORD and not CONST_ZIP_BIN_7ZZ_PATH.exists(): # pragma: no cover +if not CONST_ZIP_BIN_7ZZ_PATH.exists(): # pragma: no cover raise RuntimeError( - f"`{ZIP_ARCHIVE_PASSWORD}` is set but `{CONST_ZIP_BIN_7ZZ_PATH}`" - " binary does not exists, did you forget to create it?" + f"`{CONST_ZIP_BIN_7ZZ_PATH}` binary does not exists, did you forget to create it?" )