feature(backups): localfile repo

This commit is contained in:
Houkime 2023-02-20 11:32:25 +00:00
parent 865c8f5280
commit c493a49daa
4 changed files with 12 additions and 3 deletions

View file

@ -3,4 +3,4 @@ from selfprivacy_api.backup.restic_backuper import ResticBackuper
class Backblaze(AbstractBackupProvider): class Backblaze(AbstractBackupProvider):
backuper = ResticBackuper("--b2-account", "--b2-key", "b2") backuper = ResticBackuper("--b2-account", "--b2-key", ":b2:")

View file

@ -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}/")

View file

@ -3,4 +3,4 @@ from selfprivacy_api.backup.restic_backuper import ResticBackuper
class InMemoryBackup(AbstractBackupProvider): class InMemoryBackup(AbstractBackupProvider):
backuper = ResticBackuper("", "", "memory") backuper = ResticBackuper("", "", ":memory:")

View file

@ -24,7 +24,7 @@ class ResticBackuper(AbstractBackuper):
def restic_repo(self, repository_name: str) -> str: 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://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 # 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): def rclone_args(self):
return "rclone.args=serve restic --stdio" + self.backend_rclone_args() return "rclone.args=serve restic --stdio" + self.backend_rclone_args()