Snow-kal commented on code in PR #3231:
URL: https://github.com/apache/dubbo-go/pull/3231#discussion_r2901369049
##########
protocol/grpc/server.go:
##########
@@ -139,12 +121,7 @@ func (s *Server) Start(url *common.URL) {
logger.Infof("gRPC Server initialized the
TLSConfig configuration")
serverOpts = append(serverOpts,
grpc.Creds(credentials.NewTLS(cfg)))
}
- } else {
- serverOpts = append(serverOpts,
grpc.Creds(insecure.NewCredentials()))
}
- } else {
- // TODO: remove this else
- serverOpts = append(serverOpts,
grpc.Creds(insecure.NewCredentials()))
}
Review Comment:
OK 感谢建议 已经更改
<img width="1416" height="1047" alt="image"
src="https://github.com/user-attachments/assets/2f179169-2b8f-44c1-bea4-3c0e3595614e"
/>
新逻辑总结一下是这样的 可以吗
```
transportCreds = insecure.NewCredentials() // 默认值:无 TLS
if url 有 TLSConfigKey && TLS 有效 && cfg != nil {
transportCreds = credentials.NewTLS(cfg) // 覆盖为 TLS
}
serverOpts = append(serverOpts, grpc.Creds(transportCreds)) // 只 append 一次
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]