@@ -197,10 +197,8 @@ when defined(libp2p_autotls_support):
197197 return false
198198
199199 # generate autotls domain string: "*.{peerID}.{dnsServerURL}"
200- let baseDomain = api.Domain (
201- encodePeerId (self.peerInfo.peerId) & " ." & AutoTLSDNSServer &
202- self.config.dnsServerURL
203- )
200+ let baseDomain =
201+ api.Domain (encodePeerId (self.peerInfo.peerId) & " ." & self.config.dnsServerURL)
204202 let domain = api.Domain (" *." & baseDomain)
205203
206204 let acmeClient = self.acmeClient
@@ -260,7 +258,7 @@ when defined(libp2p_autotls_support):
260258 let derPrivKey = certKeyPair.seckey.rsakey.getBytes.valueOr:
261259 raise newException (AutoTLSError , " Unable to get TLS private key" )
262260 let pemPrivKey: string = derPrivKey.pemEncode (" PRIVATE KEY" )
263- debug " autotls cert" , pemPrivKey = pemPrivKey, cert = certificate.rawCertificate
261+ debug " Autotls cert" , pemPrivKey = pemPrivKey, cert = certificate.rawCertificate
264262
265263 trace " Installing certificate"
266264 let newCert =
@@ -311,7 +309,9 @@ when defined(libp2p_autotls_support):
311309 await self.tryIssueCertificate ()
312310
313311 # AutotlsService will renew the cert 1h before it expires
314- let cert = self.cert.get
312+ let cert = self.cert.valueOr:
313+ error " Could not issue certificate"
314+ return
315315 let waitTime = cert.expiry - Moment .now - self.config.renewBufferTime
316316 if waitTime <= self.config.renewBufferTime:
317317 await self.tryIssueCertificate ()
0 commit comments