Fix error when loading cert if tls is disabled (#4618)

If TLS is disabled, it should not be an error if no cert is given.

Fixes #4554.
This commit is contained in:
Richard van der Hoff 2019-02-12 10:51:31 +00:00 committed by GitHub
parent 46b8a79b3a
commit 32b781bfe2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 47 additions and 18 deletions

View file

@ -213,12 +213,13 @@ def refresh_certificate(hs):
Refresh the TLS certificates that Synapse is using by re-reading them from
disk and updating the TLS context factories to use them.
"""
hs.config.read_certificate_from_disk()
if not hs.config.has_tls_listener():
# nothing else to do here
# attempt to reload the certs for the good of the tls_fingerprints
hs.config.read_certificate_from_disk(require_cert_and_key=False)
return
hs.config.read_certificate_from_disk(require_cert_and_key=True)
hs.tls_server_context_factory = context_factory.ServerContextFactory(hs.config)
if hs._listening_services: