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