mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-02 20:17:35 +08:00
parent
14e544a6aa
commit
3ba6629daa
@ -172,7 +172,7 @@ etcd:
|
|||||||
# read: 5000 # default 5000ms
|
# read: 5000 # default 5000ms
|
||||||
|
|
||||||
plugins: # plugin list
|
plugins: # plugin list
|
||||||
- example-plugin
|
#- example-plugin
|
||||||
- limit-req
|
- limit-req
|
||||||
- limit-count
|
- limit-count
|
||||||
- limit-conn
|
- limit-conn
|
||||||
|
@ -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).
|
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.
|
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.
|
||||||
|
|
||||||
|
@ -199,7 +199,17 @@ curl http://127.0.0.1:9080/apisix/admin/routes/102 -H 'X-API-KEY: edd1c9f034335f
|
|||||||
优先级更高。
|
优先级更高。
|
||||||
|
|
||||||
一个插件在一次请求中只会执行一次,即使被同时绑定到多个不同对象中(比如 Route 或 Service)。
|
一个插件在一次请求中只会执行一次,即使被同时绑定到多个不同对象中(比如 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` 下。它内部是使用插件
|
插件配置作为 Route 或 Service 的一部分提交的,放到 `plugins` 下。它内部是使用插件
|
||||||
名字作为哈希的 key 来保存不同插件的配置项。
|
名字作为哈希的 key 来保存不同插件的配置项。
|
||||||
|
2
t/APISIX.pm
vendored
2
t/APISIX.pm
vendored
@ -71,6 +71,8 @@ if ($enable_local_dns) {
|
|||||||
|
|
||||||
|
|
||||||
my $default_yaml_config = read_file("conf/config-default.yaml");
|
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 $user_yaml_config = read_file("conf/config.yaml");
|
||||||
my $ssl_crt = read_file("conf/cert/apisix.crt");
|
my $ssl_crt = read_file("conf/cert/apisix.crt");
|
||||||
my $ssl_key = read_file("conf/cert/apisix.key");
|
my $ssl_key = read_file("conf/cert/apisix.key");
|
||||||
|
Loading…
Reference in New Issue
Block a user