Browse Source

refactor

pull/1475/head
Chris Lu 4 years ago
parent
commit
c2faab23b6
  1. 6
      weed/security/tls.go

6
weed/security/tls.go

@ -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()

Loading…
Cancel
Save