feat: move get_subdomain to parent class really

This commit is contained in:
dettlaff 2024-06-16 12:00:09 +04:00 committed by nhnn
parent 894457d0b4
commit 4eaefc8321
2 changed files with 5 additions and 11 deletions

View file

@ -44,14 +44,6 @@ class Roundcube(Service):
subdomain = get_subdomain()
return f"https://{subdomain}.{domain}"
@staticmethod
def get_subdomain() -> Optional[str]:
with ReadUserData() as data:
if "roundcube" in data["modules"]:
return data["modules"]["roundcube"]["subdomain"]
return "webmail"
@staticmethod
def is_movable() -> bool:
return False

View file

@ -1,4 +1,5 @@
"""Abstract class for a service running on a server"""
from abc import ABC, abstractmethod
from typing import List, Optional
@ -73,13 +74,14 @@ class Service(ABC):
"""
pass
@staticmethod
@abstractmethod
def get_subdomain() -> Optional[str]:
"""
The assigned primary subdomain for this service.
"""
pass
with ReadUserData() as data:
if self.get_display_name() in data["modules"]:
if "subdomain" in data["modules"][self.get_display_name()]:
return data["modules"][self.get_display_name()]["subdomain"]
@classmethod
def get_user(cls) -> Optional[str]: