Copilot commented on code in PR #12333:
URL: https://github.com/apache/apisix/pull/12333#discussion_r2153802642
##########
apisix/core/config_yaml.lua:
##########
@@ -69,9 +68,35 @@ local mt = {
end
}
+local apisix_config
+local apisix_config_mtime
+
+local apisix_yaml_path = profile:yaml_path("apisix")
+local apisix_json_path = ngx.re.sub(apisix_yaml_path, [[\.yaml$]], ".json",
"jo")
+local file_configs = {
+ {path = apisix_yaml_path, type = "yaml"},
+ {path = apisix_json_path, type = "json"}
+}
+
+local function get_config_file_info()
+ local paths_str = ""
+ for i, config in ipairs(file_configs) do
+ local attributes, err = lfs.attributes(config.path)
+ if attributes then
+ local last_modification_time = attributes.modification
+ return config.path, config.type, last_modification_time
Review Comment:
[nitpick] Consider capturing and documenting the multiple return values
(file path, type, and modification time) from get_config_file_info(). This will
help clarify how subsequent calls use only the file path and may avoid
potential confusion.
```suggestion
-- Example usage of get_config_file_info()
local config_info = get_config_file_info()
local apisix_config_path = config_info and config_info.path
local function get_config_file_info()
local paths_str = ""
for i, config in ipairs(file_configs) do
local attributes, err = lfs.attributes(config.path)
if attributes then
local last_modification_time = attributes.modification
return {path = config.path, type = config.type,
modification_time = last_modification_time}
```
--
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]