From aeb66b9c7225ff216bc6289d8208394300ff8488 Mon Sep 17 00:00:00 2001 From: Houkime <> Date: Mon, 20 Feb 2023 11:32:25 +0000 Subject: [PATCH] feature(backups): localfile repo --- selfprivacy_api/backup/providers/backblaze.py | 2 +- selfprivacy_api/backup/providers/local_file.py | 9 +++++++++ selfprivacy_api/backup/providers/memory.py | 2 +- selfprivacy_api/backup/restic_backuper.py | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) create mode 100644 selfprivacy_api/backup/providers/local_file.py diff --git a/selfprivacy_api/backup/providers/backblaze.py b/selfprivacy_api/backup/providers/backblaze.py index e16e9d3..9ec5eba 100644 --- a/selfprivacy_api/backup/providers/backblaze.py +++ b/selfprivacy_api/backup/providers/backblaze.py @@ -3,4 +3,4 @@ from selfprivacy_api.backup.restic_backuper import ResticBackuper class Backblaze(AbstractBackupProvider): - backuper = ResticBackuper("--b2-account", "--b2-key", "b2") + backuper = ResticBackuper("--b2-account", "--b2-key", ":b2:") diff --git a/selfprivacy_api/backup/providers/local_file.py b/selfprivacy_api/backup/providers/local_file.py new file mode 100644 index 0000000..5ae45bd --- /dev/null +++ b/selfprivacy_api/backup/providers/local_file.py @@ -0,0 +1,9 @@ +from .provider import AbstractBackupProvider +from selfprivacy_api.backup.restic_backuper import ResticBackuper + + +class LocalFileBackup(AbstractBackupProvider): + backuper = ResticBackuper("", "", "memory") + + def __init__(self, filename: str): + self.backuper = ResticBackuper("", "", f":local:{filename}/") diff --git a/selfprivacy_api/backup/providers/memory.py b/selfprivacy_api/backup/providers/memory.py index 4ddf571..3f257bf 100644 --- a/selfprivacy_api/backup/providers/memory.py +++ b/selfprivacy_api/backup/providers/memory.py @@ -3,4 +3,4 @@ from selfprivacy_api.backup.restic_backuper import ResticBackuper class InMemoryBackup(AbstractBackupProvider): - backuper = ResticBackuper("", "", "memory") + backuper = ResticBackuper("", "", ":memory:") diff --git a/selfprivacy_api/backup/restic_backuper.py b/selfprivacy_api/backup/restic_backuper.py index 0e36f4d..7980e46 100644 --- a/selfprivacy_api/backup/restic_backuper.py +++ b/selfprivacy_api/backup/restic_backuper.py @@ -24,7 +24,7 @@ class ResticBackuper(AbstractBackuper): def restic_repo(self, repository_name: str) -> str: # https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#other-services-via-rclone # https://forum.rclone.org/t/can-rclone-be-run-solely-with-command-line-options-no-config-no-env-vars/6314/5 - return f"rclone::{self.type}:{repository_name}/sfbackup" + return f"rclone:{self.type}{repository_name}/sfbackup" def rclone_args(self): return "rclone.args=serve restic --stdio" + self.backend_rclone_args()