shreemaan-abhishek commented on code in PR #10630:
URL: https://github.com/apache/apisix/pull/10630#discussion_r1435079485
##########
apisix/cli/ops.lua:
##########
@@ -862,6 +869,106 @@ local function start(env, ...)
end
+local function test_standalone(env)
+ local sys_conf = init_sysconf(env)
+
+ -- In order to validate the apisix.yaml we require the ngx module which is
part of openresty.
+ -- For this reason we define the script here and create a custom
nginx.config that will execute the script.
+ local validate_script = [=[
+ local config_yaml = require("apisix.core.config_local").local_conf(true)
+ local config_provider = config_yaml.deployment.config_provider
+ if config_provider == "yaml" then
+ -- Load config as done withing apisix.core.config
+ local apisix_config = require("apisix.core.config_" .. config_provider)
+ apisix_config.type = config_provider
+ apisix_config.init()
+ --local apisix_config = require("apisix.core.config_yaml")
+ --config.type = config_yaml.deployment.config_provider
+
+ -- require("apisix.discovery.init")
+ -- require("apisix.balancer")
+ -- require("apisix.admin.init")
+ -- require("apisix.timers")
+ -- require("apisix.debug")
+ -- core.config.init_worker
+
+ -- The list and order of the modules to be loaded and their configs to
be validated.
+ -- This order should match the one in apisix.init.http_init_worker
+ local modules = {
+ ['apisix.plugin'] = function()
+ local plugin = require("apisix.plugin")
+ plugin.load()
+ return plugin.init_config(false)
+ end
+ }
+ -- "apisix.router",
+ -- "apisix.http.service",
+ -- "apisix.plugin_config",
+ -- "apisix.consumer",
+ -- "apisix.consumer_group",
+ -- "apisix.secret",
+ -- "apisix.global_rules",
+ -- "apisix.upstream",
+ -- "apisix.plugins.ext-plugin.init"
+
+
+ local apisix_core = require("apisix.core")
+ apisix_core.log.orig_error = apisix_core.log.error
+
+ -- If an error is logged then mark the module as invalid
+ apisix_core.log.no_error_logs = true
+ apisix_core.log.error = function(...)
+ apisix_core.log.orig_error(...)
+ apisix_core.log.no_error_logs = false
+ end
+
+ local valid = true
+ for module_name, cfg_func in pairs(modules) do
+ apisix_core.log.no_error_logs = true
Review Comment:
i assume this was by mistake
--
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]