mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-28 06:51:28 +00:00
feature(backups): localfile repo
This commit is contained in:
parent
6821b245d2
commit
aeb66b9c72
|
@ -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:")
|
||||||
|
|
9
selfprivacy_api/backup/providers/local_file.py
Normal file
9
selfprivacy_api/backup/providers/local_file.py
Normal 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}/")
|
|
@ -3,4 +3,4 @@ from selfprivacy_api.backup.restic_backuper import ResticBackuper
|
||||||
|
|
||||||
|
|
||||||
class InMemoryBackup(AbstractBackupProvider):
|
class InMemoryBackup(AbstractBackupProvider):
|
||||||
backuper = ResticBackuper("", "", "memory")
|
backuper = ResticBackuper("", "", ":memory:")
|
||||||
|
|
|
@ -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()
|
||||||
|
|
Loading…
Reference in a new issue