Revolyssup commented on code in PR #9580:
URL: https://github.com/apache/apisix/pull/9580#discussion_r1244709847
##########
apisix/admin/plugins.lua:
##########
@@ -60,16 +70,30 @@ function _M.get(name)
return 200, http_plugins
end
- if not name then
- return 400, {error_msg = "not found plugin name"}
+ local plugin
+ -- By default search through all subsystems
+ local all_subsystem = true
+ if subsystem then
+ all_subsystem = false
+ end
+
+ -- When subsystem is passed as http or not passed at all(searching through
all)
+ if all_subsystem or subsystem == "http" then
+ plugin = plugin_get_http(name)
end
- local plugin_name = "apisix.plugins." .. name
+ -- When subsystem is passed as stream or not passed at all(searching
through all)
+ if (not plugin) and (all_subsystem or subsystem == "stream") then
+ plugin = plugin_get_stream(name)
+ end
- local ok, plugin = pcall(require, plugin_name)
- if not ok then
+ if not plugin then
+ local err = "failed to load plugin " .. name
+ if subsystem then
+ err = err .. " in subsystem ".. subsystem
+ end
Review Comment:
For /{name} , the default isn't http. It will be searched in all subsystems
unless explicitly specified. That was part of the proposal. To make things
explicit.
--
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]