Allow password to be passed to TLS context (#2719)

This commit is contained in:
Adam Hopkins
2023-03-20 12:34:36 +02:00
committed by GitHub
parent 009954003c
commit 53820bc241
5 changed files with 89 additions and 2 deletions

View File

@@ -159,7 +159,7 @@ class CertSimple(SanicSSLContext):
# try common aliases, rename to cert/key
certfile = kw["cert"] = kw.pop("certificate", None) or cert
keyfile = kw["key"] = kw.pop("keyfile", None) or key
password = kw.pop("password", None)
password = kw.get("password", None)
if not certfile or not keyfile:
raise ValueError("SSL dict needs filenames for cert and key.")
subject = {}

View File

@@ -811,7 +811,7 @@ class StartupMixin(metaclass=SanicMeta):
ssl = kwargs.get("ssl")
if isinstance(ssl, SanicSSLContext):
kwargs["ssl"] = kwargs["ssl"].sanic
kwargs["ssl"] = ssl.sanic
manager = WorkerManager(
primary.state.workers,