Beispiel #1
0
 def load(cls: Type[Client], configuration: Configuration) -> Client:
     """
     load client from settings
     :param configuration: configuration instance
     :return: client according to current settings
     """
     host = configuration.get("web", "host", fallback=None)
     port = configuration.getint("web", "port", fallback=None)
     if host is not None and port is not None:
         from ahriman.core.status.web_client import WebClient
         return WebClient(host, port)
     return cls()
Beispiel #2
0
    def __init__(self, architecture: str,
                 configuration: Configuration) -> None:
        """
        default constructor
        :param architecture: repository architecture
        :param configuration: configuration instance
        """
        Report.__init__(self, architecture, configuration)
        JinjaTemplate.__init__(self, "email", configuration)

        # base smtp settings
        self.host = configuration.get("email", "host")
        self.no_empty_report = configuration.getboolean("email",
                                                        "no_empty_report",
                                                        fallback=True)
        self.password = configuration.get("email", "password", fallback=None)
        self.port = configuration.getint("email", "port")
        self.receivers = configuration.getlist("email", "receivers")
        self.sender = configuration.get("email", "sender")
        self.ssl = SmtpSSLSettings.from_option(
            configuration.get("email", "ssl", fallback="disabled"))
        self.user = configuration.get("email", "user", fallback=None)