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

wenming 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 1ad90f7  chore: sort default plugin list for easier search (#2824)
1ad90f7 is described below

commit 1ad90f72060cf3cb1077114b30d52a44010a404d
Author: 罗泽轩 <spacewander...@gmail.com>
AuthorDate: Wed Nov 25 14:11:24 2020 +0800

    chore: sort default plugin list for easier search (#2824)
---
 apisix/admin/plugins.lua |  5 ----
 conf/config-default.yaml | 65 ++++++++++++++++++++++++------------------------
 t/APISIX.pm              |  1 +
 t/admin/plugins.t        |  2 +-
 t/core/config.t          |  2 +-
 5 files changed, 36 insertions(+), 39 deletions(-)

diff --git a/apisix/admin/plugins.lua b/apisix/admin/plugins.lua
index 8e65696..4a95d18 100644
--- a/apisix/admin/plugins.lua
+++ b/apisix/admin/plugins.lua
@@ -22,7 +22,6 @@ local pairs     = pairs
 local ipairs    = ipairs
 local pcall     = pcall
 local type      = type
-local table_remove = table.remove
 local table_sort = table.sort
 local table_insert = table.insert
 local get_uri_args = ngx.req.get_uri_args
@@ -125,10 +124,6 @@ end
 
 function _M.get_plugins_list()
     local plugins = core.config.local_conf().plugins
-    if plugins[1] == 'example-plugin' then
-        table_remove(plugins, 1)
-    end
-
     local priorities = {}
     local success = {}
     for i, name in ipairs(plugins) do
diff --git a/conf/config-default.yaml b/conf/config-default.yaml
index 2acc4db..6eaee36 100644
--- a/conf/config-default.yaml
+++ b/conf/config-default.yaml
@@ -175,47 +175,48 @@ etcd:
 #       send: 2000                    # default 2000ms
 #       read: 5000                    # default 5000ms
 
-plugins:                          # plugin list
+plugins:                          # plugin list (sorted in alphabetical order)
+  - api-breaker
+  - authz-keycloak
+  - basic-auth
+  - batch-requests
+  - consumer-restriction
+  - cors
+  - echo
   #- example-plugin
-  - limit-req
-  - limit-count
-  - limit-conn
+  - fault-injection
+  - grpc-transcode
+  - hmac-auth
+  - http-logger
+  - ip-restriction
+  - jwt-auth
+  - kafka-logger
   - key-auth
-  - basic-auth
-  - prometheus
+  - limit-conn
+  - limit-count
+  - limit-req
+  #- log-rotate
   - node-status
-  - jwt-auth
-  - zipkin
-  - ip-restriction
-  - referer-restriction
-  - grpc-transcode
-  - serverless-pre-function
-  - serverless-post-function
   - openid-connect
+  - prometheus
+  - proxy-cache
+  - proxy-mirror
   - proxy-rewrite
   - redirect
+  - referer-restriction
+  - request-id
+  - request-validation
   - response-rewrite
-  - fault-injection
-  - udp-logger
-  - wolf-rbac
-  - tcp-logger
-  - kafka-logger
-  - cors
-  - consumer-restriction
-  - syslog
-  - batch-requests
-  - http-logger
+  - serverless-post-function
+  - serverless-pre-function
   #- skywalking
-  - echo
-  - authz-keycloak
-  - uri-blocker
-  - request-validation
-  - proxy-cache
-  - proxy-mirror
-  - request-id
   - sls-logger
-  - hmac-auth
-  - api-breaker
+  - syslog
+  - tcp-logger
+  - udp-logger
+  - uri-blocker
+  - wolf-rbac
+  - zipkin
 
 stream_plugins:
   - mqtt-proxy
diff --git a/t/APISIX.pm b/t/APISIX.pm
index 957a8aa..b1361cb 100644
--- a/t/APISIX.pm
+++ b/t/APISIX.pm
@@ -71,6 +71,7 @@ if ($enable_local_dns) {
 
 
 my $default_yaml_config = read_file("conf/config-default.yaml");
+# enable example-plugin as some tests require it
 $default_yaml_config =~ s/#- example-plugin/- example-plugin/;
 
 my $user_yaml_config = read_file("conf/config.yaml");
diff --git a/t/admin/plugins.t b/t/admin/plugins.t
index 50c789f..634d9eb 100644
--- a/t/admin/plugins.t
+++ b/t/admin/plugins.t
@@ -30,7 +30,7 @@ __DATA__
 --- request
 GET /apisix/admin/plugins/list
 --- response_body_like eval
-qr/\["zipkin","request-id","fault-injection","serverless-pre-function","batch-requests","cors","ip-restriction","referer-restriction","uri-blocker","request-validation","openid-connect","wolf-rbac","hmac-auth","basic-auth","jwt-auth","key-auth","consumer-restriction","authz-keycloak","proxy-mirror","proxy-cache","proxy-rewrite","api-breaker","limit-conn","limit-count","limit-req","node-status","redirect","response-rewrite","grpc-transcode","prometheus","echo","http-logger","sls-logger","
 [...]
+qr/\["zipkin","request-id","fault-injection","serverless-pre-function","batch-requests","cors","ip-restriction","referer-restriction","uri-blocker","request-validation","openid-connect","wolf-rbac","hmac-auth","basic-auth","jwt-auth","key-auth","consumer-restriction","authz-keycloak","proxy-mirror","proxy-cache","proxy-rewrite","api-breaker","limit-conn","limit-count","limit-req","node-status","redirect","response-rewrite","grpc-transcode","prometheus","echo","http-logger","sls-logger","
 [...]
 --- no_error_log
 [error]
 
diff --git a/t/core/config.t b/t/core/config.t
index 807beac..f86186f 100644
--- a/t/core/config.t
+++ b/t/core/config.t
@@ -38,7 +38,7 @@ __DATA__
 GET /t
 --- response_body
 etcd host: http://127.0.0.1:2379
-first plugin: "example-plugin"
+first plugin: "api-breaker"
 
 
 

Reply via email to