diff --git a/conf/config-default.yaml b/conf/config-default.yaml index b5e58a64..703741ac 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 ec824645..6274f61c 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 f2f07871..abcdbc95 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 64b5a0fe..8b2c405c 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");