membphis commented on a change in pull request #1281: feature: Support for 
using Eureka as a service discovery center
URL: https://github.com/apache/incubator-apisix/pull/1281#discussion_r396044223
 
 

 ##########
 File path: lua/apisix/balancer.lua
 ##########
 @@ -194,6 +195,27 @@ local function create_server_picker(upstream, checker)
 end
 
 
+local function get_upstream_from_discovery(upstream_id)
+    if not discovery then
+        return nil
+    end
+
+    return discovery.get_service(upstream_id)
+end
+
+
+local function get_upstream_from_config(up_id)
+    if not upstreams_etcd then
+        return nil, "need to create a etcd instance for fetching upstream 
information"
+    end
+
+    local up_obj = upstreams_etcd:get(tostring(up_id))
+    if not up_obj then
+        return nil, "failed to find upstream by id: " .. up_id
+    end
+    return up_obj
 
 Review comment:
   add a blank line before this line

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to