feat: Log certificate actions using Info

This commit is contained in:
PapaTutuWawa 2024-01-01 14:53:57 +01:00
parent 12aef17cc0
commit e390ca6047

View File

@ -77,12 +77,14 @@ func MakeTlsConfig(pagesDomain, cachePath string, cache *certificates.Certificat
defer unlockDomain(domain)
// Renew
log.Debugf("Certificate for %s expired, renewing", domain)
log.Infof("Certificate for %s expired, renewing", domain)
newCert, err := certificates.RenewCertificate(&cert, acmeClient)
if err != nil {
log.Errorf("Failed to renew certificate for %s: %v", domain, err)
return cert.TlsCertificate, nil
}
log.Info("Successfully renewed certificate!")
cache.AddCert(newCert, cachePath)
return newCert.TlsCertificate, nil
}
@ -94,7 +96,7 @@ func MakeTlsConfig(pagesDomain, cachePath string, cache *certificates.Certificat
defer unlockDomain(domain)
// Request new certificate
log.Debugf("Obtaining new certificate for %s...", domain)
log.Infof("Obtaining new certificate for %s...", domain)
cert, err := certificates.ObtainNewCertificate(
[]string{domain},
acmeClient,
@ -109,6 +111,7 @@ func MakeTlsConfig(pagesDomain, cachePath string, cache *certificates.Certificat
}
// Add to cache and flush
log.Info("Successfully obtained new certificate!")
cache.AddCert(cert, cachePath)
return cert.TlsCertificate, nil
}