Use the first static certificate as a fallback when no default is given

This commit is contained in:
SALLEYRON Julien 2018-09-29 00:04:02 +02:00 committed by Traefiker Bot
parent 1d8bdd4384
commit 8cc3c4a6b7
3 changed files with 37 additions and 10 deletions

View file

@ -207,6 +207,11 @@ func (gc *GlobalConfiguration) SetEffectiveConfiguration(configFile string) {
entryPoint.WhitelistSourceRange = nil
}
}
if entryPoint.TLS != nil && entryPoint.TLS.DefaultCertificate == nil && len(entryPoint.TLS.Certificates) > 0 {
log.Infof("No tls.defaultCertificate given for %s: using the first item in tls.certificates as a fallback.", entryPointName)
entryPoint.TLS.DefaultCertificate = &entryPoint.TLS.Certificates[0]
}
}
// Make sure LifeCycle isn't nil to spare nil checks elsewhere.