You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2020/11/10 00:53:04 UTC

[apisix] branch master updated: feat: disable example-plugin by default (#2673)

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

spacewander 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 3ba6629  feat: disable example-plugin by default (#2673)
3ba6629 is described below

commit 3ba6629daab62a25a8a06c0e33c236599ff76347
Author: 罗泽轩 <sp...@gmail.com>
AuthorDate: Tue Nov 10 08:46:54 2020 +0800

    feat: disable example-plugin by default (#2673)
    
    Close #2659.
---
 conf/config-default.yaml         |  2 +-
 doc/architecture-design.md       | 12 +++++++++++-
 doc/zh-cn/architecture-design.md | 12 +++++++++++-
 t/APISIX.pm                      |  2 ++
 4 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/conf/config-default.yaml b/conf/config-default.yaml
index b5e58a6..703741a 100644
--- a/conf/config-default.yaml
+++ b/conf/config-default.yaml
@@ -172,7 +172,7 @@ etcd:
 #       read: 5000                    # default 5000ms
 
 plugins:                          # plugin list
-  - example-plugin
+  #- example-plugin
   - limit-req
   - limit-count
   - limit-conn
diff --git a/doc/architecture-design.md b/doc/architecture-design.md
index ec82464..6274f61 100644
--- a/doc/architecture-design.md
+++ b/doc/architecture-design.md
@@ -194,7 +194,17 @@ The configuration of the plugin can be directly bound to the specified Route, or
 
 A plugin will only be executed once in a single request, even if it is bound to multiple different objects (such as Route or Service).
 
-The order in which plugins are run is determined by the priority of the plugin itself, for example: [example-plugin](../apisix/plugins/example-plugin.lua#L37).
+The order in which plugins are run is determined by the priority of the plugin itself, for example:
+
+```lua
+local _M = {
+    version = 0.1,
+    priority = 0, -- the priority of this plugin will be 0
+    name = plugin_name,
+    schema = schema,
+    metadata_schema = metadata_schema,
+}
+```
 
 The plugin configuration is submitted as part of Route or Service and placed under `plugins`. It internally uses the plugin name as the hash's key to hold configuration items for different plugins.
 
diff --git a/doc/zh-cn/architecture-design.md b/doc/zh-cn/architecture-design.md
index f2f0787..abcdbc9 100644
--- a/doc/zh-cn/architecture-design.md
+++ b/doc/zh-cn/architecture-design.md
@@ -199,7 +199,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/102 -H 'X-API-KEY: edd1c9f034335f
 优先级更高。
 
 一个插件在一次请求中只会执行一次,即使被同时绑定到多个不同对象中(比如 Route 或 Service)。
-插件运行先后顺序是根据插件自身的优先级来决定的,例如:[example-plugin](../../apisix/plugins/example-plugin.lua#L37)。
+插件运行先后顺序是根据插件自身的优先级来决定的,例如:
+
+```lua
+local _M = {
+    version = 0.1,
+    priority = 0, -- 这个插件的优先级为 0
+    name = plugin_name,
+    schema = schema,
+    metadata_schema = metadata_schema,
+}
+```
 
 插件配置作为 Route 或 Service 的一部分提交的,放到 `plugins` 下。它内部是使用插件
 名字作为哈希的 key 来保存不同插件的配置项。
diff --git a/t/APISIX.pm b/t/APISIX.pm
index 64b5a0f..8b2c405 100644
--- a/t/APISIX.pm
+++ b/t/APISIX.pm
@@ -71,6 +71,8 @@ if ($enable_local_dns) {
 
 
 my $default_yaml_config = read_file("conf/config-default.yaml");
+$default_yaml_config =~ s/#- example-plugin/- example-plugin/;
+
 my $user_yaml_config = read_file("conf/config.yaml");
 my $ssl_crt = read_file("conf/cert/apisix.crt");
 my $ssl_key = read_file("conf/cert/apisix.key");