Only read in TLS certs when the key and cert are present.
This commit is contained in:
@@ -953,12 +953,14 @@ func configTLS(args configTLSArgs, cc *ConnConfig) error {
|
|||||||
return fmt.Errorf(`both "sslcert" and "sslkey" are required`)
|
return fmt.Errorf(`both "sslcert" and "sslkey" are required`)
|
||||||
}
|
}
|
||||||
|
|
||||||
cert, err := tls.LoadX509KeyPair(sslcert, sslkey)
|
if sslcert != "" && sslkey != "" {
|
||||||
if err != nil {
|
cert, err := tls.LoadX509KeyPair(sslcert, sslkey)
|
||||||
return errors.Wrap(err, "unable to read cert")
|
if err != nil {
|
||||||
}
|
return errors.Wrap(err, "unable to read cert")
|
||||||
|
}
|
||||||
|
|
||||||
cc.TLSConfig.Certificates = []tls.Certificate{cert}
|
cc.TLSConfig.Certificates = []tls.Certificate{cert}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user