Skip to content

Commit 485f04d

Browse files
authored
fix: only parse and validate apisix.yaml in cli when startup (#12216)
Signed-off-by: Nic <[email protected]>
1 parent 98deae7 commit 485f04d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

apisix/cli/file.lua

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
-- limitations under the License.
1616
--
1717

18+
local ngx = ngx
1819
local yaml = require("lyaml")
1920
local profile = require("apisix.core.profile")
2021
local util = require("apisix.cli.util")
@@ -293,7 +294,9 @@ function _M.read_yaml_conf(apisix_home)
293294
end
294295
end
295296

296-
if default_conf.deployment.config_provider == "yaml" then
297+
--- using `not ngx` to check whether the current execution environment is apisix cli module,
298+
--- because it is only necessary to parse and validate `apisix.yaml` in apisix cli.
299+
if default_conf.deployment.config_provider == "yaml" and not ngx then
297300
local apisix_conf_path = profile:yaml_path("apisix")
298301
local apisix_conf_yaml, _ = util.read_file(apisix_conf_path)
299302
if apisix_conf_yaml then

0 commit comments

Comments
 (0)