justxuewei commented on code in PR #2061:
URL: https://github.com/apache/dubbo-go/pull/2061#discussion_r979534265


##########
common/host_util.go:
##########
@@ -30,3 +32,19 @@ func GetLocalIp() string {
        localIp, _ = gxnet.GetLocalIP()
        return localIp
 }
+
+func HandleRegisterIPAndPort(url *URL) {
+       // if developer define registry port and ip, use it first.
+       if ipToRegistry := os.Getenv("DUBBO_IP_TO_REGISTRY"); len(ipToRegistry) 
> 0 {
+               url.Ip = ipToRegistry
+       }
+       if len(url.Ip) == 0 {
+               url.Ip = GetLocalIp()
+       }
+       if portToRegistry := os.Getenv("DUBBO_PORT_TO_REGISTRY"); 
len(portToRegistry) > 0 {
+               url.Port = portToRegistry
+       }

Review Comment:
   Plus, I am thinking here needs a port inspection, for example, a port 
exceeded 65535.



-- 
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]

Reply via email to