SkyeYoung commented on code in PR #12333:
URL: https://github.com/apache/apisix/pull/12333#discussion_r2158468726


##########
apisix/core/config_yaml.lua:
##########
@@ -127,36 +186,15 @@ local function read_apisix_yaml(premature, pre_mtime)
         return
     end
 
-    local f, err = io.open(apisix_yaml_path, "r")
-    if not f then
-        log.error("failed to open file ", apisix_yaml_path, " : ", err)
-        return
-    end
-
-    f:seek('end', -10)
-    local end_flag = f:read("*a")
-    -- log.info("flag: ", end_flag)
-    local found_end_flag = re_find(end_flag, [[#END\s*$]], "jo")
-
-    if not found_end_flag then
-        f:close()
-        log.warn("missing valid end flag in file ", apisix_yaml_path)
-        return
-    end
-
-    f:seek('set')
-    local yaml_config = f:read("*a")
-    f:close()
-
-    local apisix_yaml_new = yaml.load(yaml_config)
-    if not apisix_yaml_new then
-        log.error("failed to parse the content of file " .. apisix_yaml_path)
+    local config_new, err = config_file.parse()
+    if err then
+        log.error("failed to parse the content of file " .. config_file.path 
.. ": " .. err)

Review Comment:
   done



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