0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-12-17 08:23:54 +01:00

Fetch ACME domain into an instance member

This commit is contained in:
Brendan Abolivier 2019-02-19 10:54:33 +00:00
parent 45bb55c6de
commit a8626901cd

View file

@ -56,6 +56,7 @@ class AcmeHandler(object):
def __init__(self, hs): def __init__(self, hs):
self.hs = hs self.hs = hs
self.reactor = hs.get_reactor() self.reactor = hs.get_reactor()
self._acme_domain = hs.config.acme_domain
@defer.inlineCallbacks @defer.inlineCallbacks
def start_listening(self): def start_listening(self):
@ -123,15 +124,15 @@ class AcmeHandler(object):
@defer.inlineCallbacks @defer.inlineCallbacks
def provision_certificate(self): def provision_certificate(self):
logger.warning("Reprovisioning %s", self.hs.config.acme_domain) logger.warning("Reprovisioning %s", self._acme_domain)
try: try:
yield self._issuer.issue_cert(self.hs.config.acme_domain) yield self._issuer.issue_cert(self._acme_domain)
except Exception: except Exception:
logger.exception("Fail!") logger.exception("Fail!")
raise raise
logger.warning("Reprovisioned %s, saving.", self.hs.config.acme_domain) logger.warning("Reprovisioned %s, saving.", self._acme_domain)
cert_chain = self._store.certs[self.hs.config.acme_domain] cert_chain = self._store.certs[self._acme_domain]
try: try:
with open(self.hs.config.tls_private_key_file, "wb") as private_key_file: with open(self.hs.config.tls_private_key_file, "wb") as private_key_file: