wayne-cheng commented on a change in pull request #4856:
URL: https://github.com/apache/apisix/pull/4856#discussion_r693304674
##########
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:
Since the config `apisix.node_listen[]` also has the property
`enable_http2`, the branch can be reduced.
Port conflicts should be checked at the TCP layer, not the scheme
`http/https`, so the scheme would not be add to this key.
--
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]