[GitHub] [apisix] starsz commented on a change in pull request #2566: chore: move try_read_attr function into table.lua (#2257)
starsz commented on a change in pull request #2566: URL: https://github.com/apache/apisix/pull/2566#discussion_r514788575 ## File path: apisix/plugins/hmac-auth.lua ## @@ -328,7 +312,7 @@ local function get_params(ctx) local date_key = DATE_KEY local signed_headers_key = SIGNED_HEADERS_KEY -if try_attr(local_conf, "plugin_attr", "hmac-auth") then +if core.table.try_read_attr(local_conf, "plugin_attr", "hmac-auth") then local attr = local_conf.plugin_attr["hmac-auth"] Review comment: OK. I had fixed. ## File path: apisix/plugins/log-rotate.lua ## @@ -152,25 +150,11 @@ local function scan_log_folder() end -local function try_attr(t, ...) -local count = select('#', ...) -for i = 1, count do -local attr = select(i, ...) -t = t[attr] -if type(t) ~= "table" then -return false -end -end - -return true -end - - local function rotate() local local_conf = core.config.local_conf() local interval = INTERVAL local max_kept = MAX_KEPT -if try_attr(local_conf, "plugin_attr", "log-rotate") then +if core.table.try_read_attr(local_conf, "plugin_attr", "log-rotate") then local attr = local_conf.plugin_attr["log-rotate"] Review comment: OK. I had fixed. 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: us...@infra.apache.org
[GitHub] [apisix] starsz commented on a change in pull request #2566: chore: move try_read_attr function into table.lua (#2257)
starsz commented on a change in pull request #2566: URL: https://github.com/apache/apisix/pull/2566#discussion_r514368879 ## File path: apisix/plugins/hmac-auth.lua ## @@ -29,6 +28,7 @@ local core = require("apisix.core") local hmac = require("resty.hmac") local consumer = require("apisix.consumer") local ngx_decode_base64 = ngx.decode_base64 +local try_read_attr = core.table.try_read_attr Review comment: OK. Let me fix those points. 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: us...@infra.apache.org
[GitHub] [apisix] starsz commented on a change in pull request #2566: chore: move try_read_attr function into table.lua (#2257)
starsz commented on a change in pull request #2566: URL: https://github.com/apache/apisix/pull/2566#discussion_r514260862 ## File path: apisix/core/table.lua ## @@ -59,6 +59,22 @@ function _M.set(tab, ...) end +function _M.try_read_attr(tab, ...) Review comment: Sorry, I forgot. 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: us...@infra.apache.org