This commit is contained in:
Chris Lu 2020-09-20 15:40:49 -07:00
parent d013d09a9b
commit c2faab23b6

View file

@ -45,8 +45,8 @@ func LoadClientTLS(config *viper.Viper, component string) grpc.DialOption {
return grpc.WithInsecure()
}
certFileName, keyFileName := config.GetString(component+".cert"), config.GetString(component+".key")
if certFileName == "" || keyFileName == "" {
certFileName, keyFileName, caFileName := config.GetString(component+".cert"), config.GetString(component+".key"), config.GetString(component+".ca")
if certFileName == "" || keyFileName == "" || caFileName == "" {
return grpc.WithInsecure()
}
@ -56,7 +56,7 @@ func LoadClientTLS(config *viper.Viper, component string) grpc.DialOption {
glog.V(1).Infof("load cert/key error: %v", err)
return grpc.WithInsecure()
}
caCert, err := ioutil.ReadFile(config.GetString(component + ".ca"))
caCert, err := ioutil.ReadFile(caFileName)
if err != nil {
glog.V(1).Infof("read ca cert file error: %v", err)
return grpc.WithInsecure()