From 700472249983264cfc99bf9a90c4533b6231b625 Mon Sep 17 00:00:00 2001 From: Eric Callahan Date: Fri, 19 Aug 2022 13:42:16 -0400 Subject: [PATCH] app: report if https is enabled Signed-off-by: Eric Callahan --- moonraker/app.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/moonraker/app.py b/moonraker/app.py index caa4fce..c9a70db 100644 --- a/moonraker/app.py +++ b/moonraker/app.py @@ -262,7 +262,7 @@ class MoonrakerApp: self.http_server = self.app.listen( port, address=host, max_body_size=MAX_BODY_SIZE, xheaders=True) - if self.cert_path.exists() and self.key_path.exists(): + if self.https_enabled(): logging.info(f"Starting secure server on port {ssl_port}") ssl_ctx = ssl.create_default_context(ssl.Purpose.CLIENT_AUTH) ssl_ctx.load_cert_chain(self.cert_path, self.key_path) @@ -299,6 +299,9 @@ class MoonrakerApp: def get_asset_path(self) -> pathlib.Path: return ASSET_PATH + def https_enabled(self) -> bool: + return self.cert_path.exists() and self.key_path.exists() + async def close(self) -> None: if self.http_server is not None: self.http_server.stop()