Skip to content

Commit

Permalink
Fix linting error
Browse files Browse the repository at this point in the history
  • Loading branch information
viklund committed Nov 17, 2020
1 parent 1477e5a commit 17acae7
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions elastic.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,21 @@ func transportConfigES(config ElasticConfig) http.RoundTripper {
}

if config.verifyPeer {
if config.clientCert != "" && config.clientKey != "" {
cert, e := ioutil.ReadFile(config.clientCert)
if e != nil {
log.Fatalf("failed to append client cert %q: %v", config.clientCert, e)
}
key, e := ioutil.ReadFile(config.clientKey)
if e != nil {
log.Fatalf("failed to append key %q: %v", config.clientKey, e)
}
if certs, e := tls.X509KeyPair(cert, key); e == nil {
cfg.Certificates = append(cfg.Certificates, certs)
}
} else {
if config.clientCert == "" || config.clientKey == "" {
log.Fatalf("No client cert or key were provided")
}

cert, e := ioutil.ReadFile(config.clientCert)
if e != nil {
log.Fatalf("failed to append client cert %q: %v", config.clientCert, e)
}
key, e := ioutil.ReadFile(config.clientKey)
if e != nil {
log.Fatalf("failed to append key %q: %v", config.clientKey, e)
}
if certs, e := tls.X509KeyPair(cert, key); e == nil {
cfg.Certificates = append(cfg.Certificates, certs)
}
}

var trConfig http.RoundTripper = &http.Transport{
Expand Down

0 comments on commit 17acae7

Please sign in to comment.