`x-tls-cert` and `x-tls-key` must set both.

This commit is contained in:
Tatsuhito KATO 2018-08-14 07:43:14 +00:00
parent 9d36dd9841
commit 9049e49f9e
1 changed files with 2 additions and 2 deletions

View File

@ -143,8 +143,8 @@ func (m *Mysql) Open(url string) (database.Driver, error) {
}
clientCert := make([]tls.Certificate, 0, 1)
if purl.Query().Get("x-tls-cert") != "" && purl.Query().Get("x-tls-key") != "" {
certs, err := tls.LoadX509KeyPair(purl.Query().Get("x-tls-cert"), purl.Query().Get("x-tls-key"))
if ccert, ckey := purl.Query().Get("x-tls-cert"), purl.Query().Get("x-tls-key"); ccert != "" || ckey != "" {
certs, err := tls.LoadX509KeyPair(ccert, ckey)
if err != nil {
return nil, err
}