You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2020/12/25 01:40:04 UTC

[GitHub] [apisix] spacewander commented on a change in pull request #2886: feat: provide the ability to view plug-in types

spacewander commented on a change in pull request #2886:
URL: https://github.com/apache/apisix/pull/2886#discussion_r548773984



##########
File path: doc/admin-api.md
##########
@@ -744,3 +744,15 @@ Content-Type: text/plain
 ```
 
 [Back to TOC](#Table-of-Contents)
+
+*API*:/apisix/admin/plugins/?all=true
+
+*Description*: all the attributes of all plugins, each plug-in includes `name`, `priority`, `type`, `schema`, `consumer_schema` and `version`.

Review comment:
       `plug-in` should be plugin, since `plugins` is used in the same sentence.

##########
File path: apisix/admin/plugins.lua
##########
@@ -37,7 +37,42 @@ function _M.stream_check_schema(plugins_conf, schema_type)
 end
 
 
+local function get_plugins_all_attributes()
+    local plugins = core.config.local_conf().plugins
+    local all_attributes = core.table.new(#plugins, 0)
+    for _, name in ipairs(plugins) do
+        local plugin_name = "apisix.plugins." .. name
+        local ok, plugin = pcall(require, plugin_name)

Review comment:
       There is not need to reload all the plugins. You can directly get them like:
   https://github.com/apache/apisix/blob/0802c95faf4c5615c3b9fbe56ef913be7af08287/apisix/control/v1.lua#L37-L45 




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org