Skip to content

Commit

Permalink
Proceed with certificate only if all of cert, key and CA filepaths ar…
Browse files Browse the repository at this point in the history
…e set
  • Loading branch information
vas78 committed Nov 28, 2016
1 parent 0cc18d5 commit a5e3464
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions kafka_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,9 @@ func NewKafkaClient(app *ApplicationContext, cluster string) (*KafkaClient, erro
profile := app.Config.Clientprofile[app.Config.Kafka[cluster].Clientprofile]
clientConfig.ClientID = profile.ClientID
clientConfig.Net.TLS.Enable = profile.TLS
if profile.TLSCertFilePath != "" {
if profile.TLSCertFilePath == "" || profile.TLSKeyFilePath == "" || profile.TLSCAFilePath == "" {
clientConfig.Net.TLS.Config = &tls.Config{}
} else {
caCert, err := ioutil.ReadFile(profile.TLSCAFilePath)
if err != nil {
return nil, err
Expand All @@ -67,8 +69,6 @@ func NewKafkaClient(app *ApplicationContext, cluster string) (*KafkaClient, erro
RootCAs: caCertPool,
}
clientConfig.Net.TLS.Config.BuildNameToCertificate()
} else {
clientConfig.Net.TLS.Config = &tls.Config{}
}
clientConfig.Net.TLS.Config.InsecureSkipVerify = profile.TLSNoVerify

Expand Down

0 comments on commit a5e3464

Please sign in to comment.