tokers commented on a change in pull request #3129:
URL: https://github.com/apache/apisix/pull/3129#discussion_r549345574
##########
File path: apisix/init.lua
##########
@@ -43,15 +43,18 @@ if ngx.config.subsystem == "http" then
end
local load_balancer
local local_conf
-local dns_resolver
local lru_resolved_domain
local ver_header = "APISIX/" .. core.version.VERSION
-local function parse_args(args)
- dns_resolver = args and args["dns_resolver"]
- core.utils.set_resolver(dns_resolver)
- core.log.info("dns resolver", core.json.delay_encode(dns_resolver, true))
+local function parse_args()
+ local options = {}
+ core.utils.init_dns_proxy(options)
+ if options.nameservers then
Review comment:
It's so strange here, you defined an empty `options` at line 51, in the
meanwhile you check its contents here after calling
`core.utils.init_dns_proxy`, it doesn't do any initializations for `options`.
You should fill the `options` with the config in `config.yaml`, like
`dns_resolver`.
##########
File path: apisix/core/utils.lua
##########
@@ -112,13 +104,17 @@ local function dns_parse(domain, resolvers)
return nil, "unsupport DNS answer"
end
- return dns_parse(answer.cname, resolvers)
+ return dns_parse(answer.cname)
end
_M.dns_parse = dns_parse
+function _M.init_dns_proxy (options)
Review comment:
style: redundant space before `(`.
##########
File path: apisix/init.lua
##########
@@ -201,7 +204,6 @@ local function parse_domain(host)
end
core.log.info("parse addr: ", core.json.delay_encode(ip_info))
- core.log.info("resolver: ", core.json.delay_encode(dns_resolver))
Review comment:
Could we still output it?
##########
File path: apisix/init.lua
##########
@@ -69,7 +72,7 @@ function _M.http_init(args)
"maxrecord=8000", "sizemcode=64",
"maxmcode=4000", "maxirconst=1000")
- parse_args(args)
Review comment:
We must keep the compatibility here, otherwise people use this way to
initialize DNS resolvers will be surprised after they upgrade APISIX.
----------------------------------------------------------------
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]