Improve log message about redundant TLS certificate

This commit is contained in:
mpl 2019-04-15 12:32:03 +02:00 committed by Traefiker Bot
parent 3d7633f4a6
commit ea750ad813
2 changed files with 6 additions and 6 deletions

View file

@ -107,7 +107,7 @@ func (c *Certificates) CreateTLSConfig(entryPointName string) (*tls.Config, erro
config.Certificates = append(config.Certificates, *cert)
} else {
for _, certificate := range *c {
err := certificate.AppendCertificates(domainsCertificates, entryPointName)
err := certificate.AppendCertificate(domainsCertificates, entryPointName)
if err != nil {
log.Errorf("Unable to add a certificate to the entryPoint %q : %v", entryPointName, err)
continue
@ -138,8 +138,8 @@ func (c *Certificates) isEmpty() bool {
return key == len(*c)
}
// AppendCertificates appends a Certificate to a certificates map sorted by entrypoints
func (c *Certificate) AppendCertificates(certs map[string]map[string]*tls.Certificate, ep string) error {
// AppendCertificate appends a Certificate to a certificates map keyed by entrypoint.
func (c *Certificate) AppendCertificate(certs map[string]map[string]*tls.Certificate, ep string) error {
certContent, err := c.CertFile.Read()
if err != nil {
@ -192,9 +192,9 @@ func (c *Certificate) AppendCertificates(certs map[string]map[string]*tls.Certif
}
}
if certExists {
log.Warnf("Into EntryPoint %s, try to add certificate for domains which already have this certificate (%s). The new certificate will not be append to the EntryPoint.", ep, certKey)
log.Warnf("Skipping addition of certificate for domain(s) %q, to EntryPoint %s, as it already exists for this Entrypoint.", certKey, ep)
} else {
log.Debugf("Add certificate for domains %s", certKey)
log.Debugf("Adding certificate for domain(s) %s", certKey)
certs[ep][certKey] = &tlsCert
}

View file

@ -56,7 +56,7 @@ func (m *Manager) UpdateConfigs(stores map[string]Store, configs map[string]TLS,
conf.Stores = []string{"default"}
}
for _, store := range conf.Stores {
if err := conf.Certificate.AppendCertificates(storesCertificates, store); err != nil {
if err := conf.Certificate.AppendCertificate(storesCertificates, store); err != nil {
log.Errorf("Unable to append certificate %s to store %s: %v", conf.Certificate.GetTruncatedCertificateName(), store, err)
}
}