Add TLS password to config

This commit is contained in:
Adam Hopkins 2022-02-23 10:01:12 +02:00
parent 067316af16
commit d26d79c182
No known key found for this signature in database
GPG Key ID: 9F85EE6C807303FB
2 changed files with 6 additions and 3 deletions

View File

@ -41,6 +41,7 @@ DEFAULT_CONFIG = {
"REQUEST_MAX_SIZE": 100000000, # 100 megabytes "REQUEST_MAX_SIZE": 100000000, # 100 megabytes
"REQUEST_TIMEOUT": 60, # 60 seconds "REQUEST_TIMEOUT": 60, # 60 seconds
"RESPONSE_TIMEOUT": 60, # 60 seconds "RESPONSE_TIMEOUT": 60, # 60 seconds
"TLS_CERT_PASSWORD": "",
"USE_UVLOOP": _default, "USE_UVLOOP": _default,
"WEBSOCKET_MAX_SIZE": 2**20, # 1 megabyte "WEBSOCKET_MAX_SIZE": 2**20, # 1 megabyte
"WEBSOCKET_PING_INTERVAL": 20, "WEBSOCKET_PING_INTERVAL": 20,
@ -87,6 +88,7 @@ class Config(dict, metaclass=DescriptorMeta):
REQUEST_TIMEOUT: int REQUEST_TIMEOUT: int
RESPONSE_TIMEOUT: int RESPONSE_TIMEOUT: int
SERVER_NAME: str SERVER_NAME: str
TLS_CERT_PASSWORD: str
USE_UVLOOP: Union[Default, bool] USE_UVLOOP: Union[Default, bool]
WEBSOCKET_MAX_SIZE: int WEBSOCKET_MAX_SIZE: int
WEBSOCKET_PING_INTERVAL: int WEBSOCKET_PING_INTERVAL: int

View File

@ -188,9 +188,10 @@ def get_config(app: Sanic, ssl: SSLContext):
is_client=False, is_client=False,
max_datagram_frame_size=65536, max_datagram_frame_size=65536,
) )
# TODO: password = app.config.TLS_CERT_PASSWORD or None
# - add password kwarg, read from config.TLS_CERT_PASSWORD config.load_cert_chain(
config.load_cert_chain(ssl.sanic["cert"], ssl.sanic["key"]) ssl.sanic["cert"], ssl.sanic["key"], password=password
)
return config return config