From fcb6b185105239329fd21e4af0f23e5244a2c8eb Mon Sep 17 00:00:00 2001 From: Bob Haddleton Date: Mon, 4 Jan 2021 15:44:49 -0600 Subject: [PATCH] Add web_ssl_context to allow internal web server to support https (#69) * Add web_ssl_context to allow internal web server to support https * updating version to 0.4.1 * Add web_ssl_context to allow internal web server to support https Co-authored-by: Vikram Patki 24489 --- faust/types/settings/settings.py | 12 ++++++++++++ faust/web/drivers/aiohttp.py | 1 + 2 files changed, 13 insertions(+) diff --git a/faust/types/settings/settings.py b/faust/types/settings/settings.py index 49eb2503b..5a1cde718 100644 --- a/faust/types/settings/settings.py +++ b/faust/types/settings/settings.py @@ -159,6 +159,7 @@ def __init__( web_host: str = None, web_in_thread: bool = None, web_port: int = None, + web_ssl_context: ssl.SSLContext = None, web_transport: URLArg = None, # Worker settings: worker_redirect_stdouts: bool = None, @@ -1797,6 +1798,17 @@ def web_port(self) -> int: not by passing it as a keyword argument to :class:`app`. """ + @sections.WebServer.setting( + params.SSLContext, + version_introduced="0.5.0", + default=None, + ) + def web_ssl_context(self) -> ssl.SSLContext: + """Web server SSL configuration. + + See :setting:`credentials`. + """ + @sections.WebServer.setting( params.URL, version_introduced="1.2", diff --git a/faust/web/drivers/aiohttp.py b/faust/web/drivers/aiohttp.py index 8837b14b0..40eeda700 100644 --- a/faust/web/drivers/aiohttp.py +++ b/faust/web/drivers/aiohttp.py @@ -292,6 +292,7 @@ def _new_transport_tcp(self) -> BaseSite: self._runner, self.app.conf.web_bind, self.app.conf.web_port, + ssl_context=self.app.conf.web_ssl_context, ) def _new_transport_unix(self) -> BaseSite: