Early return instead of large code block
This commit is contained in:
parent
3af5f5c311
commit
b2e5d441d2
1 changed files with 26 additions and 22 deletions
|
@ -436,7 +436,12 @@ func (l *L7) checkSSLCert() error {
|
||||||
// PrivateKey is write only, so compare certs alone. We're assuming that
|
// PrivateKey is write only, so compare certs alone. We're assuming that
|
||||||
// no one will change just the key. We can remember the key and compare,
|
// no one will change just the key. We can remember the key and compare,
|
||||||
// but a bug could end up leaking it, which feels worse.
|
// but a bug could end up leaking it, which feels worse.
|
||||||
if l.sslCert == nil || ingCert != l.sslCert.Certificate {
|
if l.sslCert != nil && ingCert == l.sslCert.Certificate {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// Controller needs to create or update the certificate.
|
||||||
|
// Generate the next certificate name to use.
|
||||||
newCertName := l.nextCertificateName()
|
newCertName := l.nextCertificateName()
|
||||||
|
|
||||||
// Perform a delete in case a certificate exists with the exact name
|
// Perform a delete in case a certificate exists with the exact name
|
||||||
|
@ -458,7 +463,6 @@ func (l *L7) checkSSLCert() error {
|
||||||
// Save the current cert for cleanup after we update the target proxy.
|
// Save the current cert for cleanup after we update the target proxy.
|
||||||
l.oldSSLCert = l.sslCert
|
l.oldSSLCert = l.sslCert
|
||||||
l.sslCert = cert
|
l.sslCert = cert
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue