This is an automated email from the ASF dual-hosted git repository.

nic443 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git


The following commit(s) were added to refs/heads/master by this push:
     new 485f04dd6 fix: only parse and validate apisix.yaml in cli when startup 
(#12216)
485f04dd6 is described below

commit 485f04dd6bfc73ec5937ae9ad30a2786b24fc213
Author: Nic <[email protected]>
AuthorDate: Fri May 23 09:07:42 2025 +0800

    fix: only parse and validate apisix.yaml in cli when startup (#12216)
    
    Signed-off-by: Nic <[email protected]>
---
 apisix/cli/file.lua | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/apisix/cli/file.lua b/apisix/cli/file.lua
index bb8fa925e..e4d2a3161 100644
--- a/apisix/cli/file.lua
+++ b/apisix/cli/file.lua
@@ -15,6 +15,7 @@
 -- limitations under the License.
 --
 
+local ngx = ngx
 local yaml = require("lyaml")
 local profile = require("apisix.core.profile")
 local util = require("apisix.cli.util")
@@ -293,7 +294,9 @@ function _M.read_yaml_conf(apisix_home)
         end
     end
 
-    if default_conf.deployment.config_provider == "yaml" then
+    --- using `not ngx` to check whether the current execution environment is 
apisix cli module,
+    --- because it is only necessary to parse and validate `apisix.yaml` in 
apisix cli.
+    if default_conf.deployment.config_provider == "yaml" and not ngx then
         local apisix_conf_path = profile:yaml_path("apisix")
         local apisix_conf_yaml, _ = util.read_file(apisix_conf_path)
         if apisix_conf_yaml then

Reply via email to