From 18d1818ae1d3def4309b648775f8c71f5fb69f4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20L=C3=B6sche?= Date: Mon, 2 Oct 2023 17:38:28 +0200 Subject: [PATCH] [resotolib][feat] Support extra args to the webserver (#1793) * [resotolib][feat] Support extra args to the webserver --- resotolib/resotolib/web/__init__.py | 3 +++ resotoworker/resotoworker/__main__.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/resotolib/resotolib/web/__init__.py b/resotolib/resotolib/web/__init__.py index 98205ade11..39172474a7 100644 --- a/resotolib/resotolib/web/__init__.py +++ b/resotolib/resotolib/web/__init__.py @@ -12,6 +12,7 @@ def __init__( web_port: int = 9955, ssl_cert: Optional[str] = None, ssl_key: Optional[str] = None, + extra_config: Optional[dict[str, Any]] = None, ) -> None: super().__init__() self.name = "webserver" @@ -20,6 +21,7 @@ def __init__( self.web_port = web_port self.ssl_cert = ssl_cert self.ssl_key = ssl_key + self.extra_config = extra_config or {} @property def serving(self) -> bool: @@ -69,6 +71,7 @@ def run(self) -> None: "request.show_tracebacks": False, "request.show_mismatched_params": False, **ssl_args, + **self.extra_config, } } ) diff --git a/resotoworker/resotoworker/__main__.py b/resotoworker/resotoworker/__main__.py index c2d4b8b3f4..848ff261b4 100644 --- a/resotoworker/resotoworker/__main__.py +++ b/resotoworker/resotoworker/__main__.py @@ -139,7 +139,8 @@ def send_request(request: requests.Request) -> requests.Response: ), web_host=Config.resotoworker.web_host, web_port=Config.resotoworker.web_port, - **web_server_args, + ssl_cert=web_server_args.get("ssl_cert"), + ssl_key=web_server_args.get("ssl_key"), ) web_server.daemon = True web_server.start()