spacewander commented on a change in pull request #4856:
URL: https://github.com/apache/apisix/pull/4856#discussion_r693300918



##########
File path: apisix/cli/ngx_tpl.lua
##########
@@ -459,11 +459,11 @@ http {
 
     server {
         {% for _, item in ipairs(node_listen) do %}
-        listen {* item.port *} default_server {% if enable_reuseport then %} 
reuseport {% end %} {% if item.enable_http2 then %} http2 {% end %};
+        listen {* item.ip *}:{* item.port *} default_server {% if 
enable_reuseport then %} reuseport {% end %};

Review comment:
       http port also need to enable_http2 

##########
File path: apisix/cli/ops.lua
##########
@@ -461,45 +461,137 @@ Please modify "admin_key" in conf/config.yaml .
         end
     end
 
-    -- support multiple ports listen, compatible with the original style
-    if type(yaml_conf.apisix.node_listen) == "number" then
+    local ip_port_to_check = {}
+
+    local function listen_table_insert(listen_table, scheme, ip, port, 
enable_ipv6, enable_http2)
+        if type(ip) ~= "string" then
+            util.die(scheme, " listen ip format error, must be string", "\n")
+        end
+
+        if type(port) ~= "number" then
+            util.die(scheme, " listen port format error, must be number", "\n")
+        end
 
-        if ports_to_check[yaml_conf.apisix.node_listen] ~= nil then
-            util.die("node_listen port ", yaml_conf.apisix.node_listen,
-                    " conflicts with ", 
ports_to_check[yaml_conf.apisix.node_listen], "\n")
+        if ports_to_check[port] ~= nil then
+            util.die(scheme, " listen port ", port, " conflicts with ",
+                ports_to_check[port], "\n")
         end
 
-        local node_listen = {{port = yaml_conf.apisix.node_listen}}
-        yaml_conf.apisix.node_listen = node_listen
+        local addr = ip .. ":" .. port

Review comment:
       We can add scheme to this key so that we can reduce a branch




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


Reply via email to