mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-18 08:29:14 +00:00
refactor(services): use fully generic foldermoves
This commit is contained in:
parent
dde86725b9
commit
65acd3173a
|
@ -154,15 +154,7 @@ class Bitwarden(Service):
|
|||
self,
|
||||
volume,
|
||||
job,
|
||||
[
|
||||
FolderMoveNames(
|
||||
name=Bitwarden.get_foldername(folder),
|
||||
bind_location=folder,
|
||||
group="vaultwarden",
|
||||
owner="vaultwarden",
|
||||
)
|
||||
for folder in Bitwarden.get_folders()
|
||||
],
|
||||
FolderMoveNames.default_foldermoves(self),
|
||||
"bitwarden",
|
||||
)
|
||||
|
||||
|
|
|
@ -34,6 +34,15 @@ class FolderMoveNames(BaseModel):
|
|||
def get_foldername(path: str) -> str:
|
||||
return path.split("/")[-1]
|
||||
|
||||
@staticmethod
|
||||
def default_foldermoves(service: Service):
|
||||
return (
|
||||
[
|
||||
FolderMoveNames.from_owned_path(folder)
|
||||
for folder in service.get_owned_folders()
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
@huey.task()
|
||||
def move_service(
|
||||
|
|
|
@ -148,15 +148,7 @@ class Gitea(Service):
|
|||
self,
|
||||
volume,
|
||||
job,
|
||||
[
|
||||
FolderMoveNames(
|
||||
name=Gitea.get_foldername(folder),
|
||||
bind_location=folder,
|
||||
group="gitea",
|
||||
owner="gitea",
|
||||
)
|
||||
for folder in Gitea.get_folders()
|
||||
],
|
||||
FolderMoveNames.default_foldermoves(self),
|
||||
"gitea",
|
||||
)
|
||||
|
||||
|
|
|
@ -37,6 +37,10 @@ class MailServer(Service):
|
|||
def get_svg_icon() -> str:
|
||||
return base64.b64encode(MAILSERVER_ICON.encode("utf-8")).decode("utf-8")
|
||||
|
||||
@staticmethod
|
||||
def get_user() -> str:
|
||||
return "virtualMail"
|
||||
|
||||
@staticmethod
|
||||
def get_url() -> typing.Optional[str]:
|
||||
"""Return service url."""
|
||||
|
@ -158,20 +162,7 @@ class MailServer(Service):
|
|||
self,
|
||||
volume,
|
||||
job,
|
||||
[
|
||||
FolderMoveNames(
|
||||
name="vmail",
|
||||
bind_location="/var/vmail",
|
||||
group="virtualMail",
|
||||
owner="virtualMail",
|
||||
),
|
||||
FolderMoveNames(
|
||||
name="sieve",
|
||||
bind_location="/var/sieve",
|
||||
group="virtualMail",
|
||||
owner="virtualMail",
|
||||
),
|
||||
],
|
||||
FolderMoveNames.default_foldermoves(self),
|
||||
"mailserver",
|
||||
)
|
||||
|
||||
|
|
|
@ -152,14 +152,7 @@ class Nextcloud(Service):
|
|||
self,
|
||||
volume,
|
||||
job,
|
||||
[
|
||||
FolderMoveNames(
|
||||
name="nextcloud",
|
||||
bind_location="/var/lib/nextcloud",
|
||||
owner="nextcloud",
|
||||
group="nextcloud",
|
||||
),
|
||||
],
|
||||
FolderMoveNames.default_foldermoves(self),
|
||||
"nextcloud",
|
||||
)
|
||||
return job
|
||||
|
|
|
@ -150,20 +150,7 @@ class Pleroma(Service):
|
|||
self,
|
||||
volume,
|
||||
job,
|
||||
[
|
||||
FolderMoveNames(
|
||||
name="pleroma",
|
||||
bind_location="/var/lib/pleroma",
|
||||
owner="pleroma",
|
||||
group="pleroma",
|
||||
),
|
||||
FolderMoveNames(
|
||||
name="postgresql",
|
||||
bind_location="/var/lib/postgresql",
|
||||
owner="postgres",
|
||||
group="postgres",
|
||||
),
|
||||
],
|
||||
FolderMoveNames.default_foldermoves(self),
|
||||
"pleroma",
|
||||
)
|
||||
return job
|
||||
|
|
Loading…
Reference in a new issue