mirror of
https://gitee.com/iresty/apisix.git
synced 2024-12-02 03:58:02 +08:00
feat: support to use path parameter with plugin's control api (#5934)
Co-authored-by: 罗泽轩 <spacewanderlzx@gmail.com>
This commit is contained in:
parent
eb8362cef7
commit
e9cea4407e
@ -16,6 +16,7 @@
|
||||
--
|
||||
local require = require
|
||||
local router = require("apisix.utils.router")
|
||||
local radixtree = require("resty.radixtree")
|
||||
local builtin_v1_routes = require("apisix.control.v1")
|
||||
local plugin_mod = require("apisix.plugin")
|
||||
local core = require("apisix.core")
|
||||
@ -154,7 +155,19 @@ function fetch_control_api_router()
|
||||
handler = empty_func,
|
||||
})
|
||||
|
||||
local with_parameter = false
|
||||
local conf = core.config.local_conf()
|
||||
if conf.apisix.enable_control and conf.apisix.control then
|
||||
if conf.apisix.control.router == "radixtree_uri_with_parameter" then
|
||||
with_parameter = true
|
||||
end
|
||||
end
|
||||
|
||||
if with_parameter then
|
||||
return radixtree.new(routes)
|
||||
else
|
||||
return router.new(routes)
|
||||
end
|
||||
end
|
||||
|
||||
end -- do
|
||||
|
@ -38,6 +38,9 @@ apisix:
|
||||
port: 9090
|
||||
```
|
||||
|
||||
The control API server does not support parameter matching by default, if you want to enable parameter matching in plugin's control API
|
||||
you can add `router: 'radixtree_uri_with_parameter'` to the `control` section.
|
||||
|
||||
Note that the control API server should not be configured to listen to the public traffic!
|
||||
|
||||
## Control API Added via plugin
|
||||
|
@ -37,6 +37,8 @@ apisix:
|
||||
port: 9090
|
||||
```
|
||||
|
||||
插件的 control API 在默认情况下不支持参数匹配,如果想启用参数匹配功能可以在 control 部分添加 `router: 'radixtree_uri_with_parameter'`
|
||||
|
||||
注意: control API server 不应该被配置成监听公网地址。
|
||||
|
||||
## 通过插件添加的 control API
|
||||
|
Loading…
Reference in New Issue
Block a user