You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/08/16 17:30:41 UTC
[GitHub] [apisix] tzssangglass opened a new pull request, #7707: change: move the disable to _meta
tzssangglass opened a new pull request, #7707:
URL: https://github.com/apache/apisix/pull/7707
### Description
<!-- Please include a summary of the change and which issue is fixed. -->
<!-- Please also include relevant motivation and context. -->
Fixes #7482
### Checklist
- [x] I have explained the need for this PR and the problem it solves
- [x] I have explained the changes or the new features added to this PR
- [ ] I have added tests corresponding to this change
- [ ] I have updated the documentation to reflect this change
- [ ] I have verified that this change is backward compatible (If not, please discuss on the [APISIX mailing list](https://github.com/apache/apisix/tree/master#community) first)
<!--
Note
1. Mark the PR as draft until it's ready to be reviewed.
2. Always add/update tests for any changes unless you have a good reason.
3. Always update the documentation to reflect the changes made in the PR.
4. Make a new commit to resolve conversations instead of `push -f`.
5. To resolve merge conflicts, merge master instead of rebasing.
6. Use "request review" to notify the reviewer after making changes.
7. Only a reviewer can mark a conversation as resolved.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander commented on a diff in pull request #7707: change: move the disable to _meta
Posted by GitBox <gi...@apache.org>.
spacewander commented on code in PR #7707:
URL: https://github.com/apache/apisix/pull/7707#discussion_r948617151
##########
apisix/plugin.lua:
##########
@@ -761,8 +770,11 @@ local function check_single_plugin_schema(name, plugin_conf, schema_type, skip_d
end
if plugin_obj.check_schema then
- local disable = plugin_conf.disable
- plugin_conf.disable = nil
+ local disable = check_disable(plugin_conf)
+ if disable ~= nil then
+ plugin_conf._meta.disable = nil
Review Comment:
Once we have moved the `disable` to _meta, we don't need to delete it during the check_schema. As there is no longer a top level extra field in the conf.
##########
docs/en/latest/terminology/plugin.md:
##########
@@ -80,10 +80,25 @@ Some common configurations can be applied to plugins through the `_meta` configu
| Name | Type | Description |
|--------------|------|-------------|
+| disable | boolean | Whether to disable the plugin |
| error_response | string/object | Custom error response |
| priority | integer | Custom plugin priority |
| filter | array | Depending on the requested parameters, it is decided at runtime whether the plugin should be executed. Something like this: `{{var, operator, val}, {var, operator, val}, ...}}`. For example: `{"arg_version", "==", "v2"}`, indicating that the current request parameter `version` is `v2`. The variables here are consistent with NGINX internal variables. For details on supported operators, please see [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list). |
+### Disable the plugin
+
+Through the `disable` configuration, you can add a new plugin with disabled status and the request will not go through the plugin. This feature is used in the APISIX Dashboard.
Review Comment:
We don't need to mention the Dashboard as this feature can be used by any other components too.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] tzssangglass commented on a diff in pull request #7707: change: move the disable to _meta
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on code in PR #7707:
URL: https://github.com/apache/apisix/pull/7707#discussion_r948723504
##########
docs/en/latest/terminology/plugin.md:
##########
@@ -80,10 +80,25 @@ Some common configurations can be applied to plugins through the `_meta` configu
| Name | Type | Description |
|--------------|------|-------------|
+| disable | boolean | Whether to disable the plugin |
| error_response | string/object | Custom error response |
| priority | integer | Custom plugin priority |
| filter | array | Depending on the requested parameters, it is decided at runtime whether the plugin should be executed. Something like this: `{{var, operator, val}, {var, operator, val}, ...}}`. For example: `{"arg_version", "==", "v2"}`, indicating that the current request parameter `version` is `v2`. The variables here are consistent with NGINX internal variables. For details on supported operators, please see [lua-resty-expr](https://github.com/api7/lua-resty-expr#operator-list). |
+### Disable the plugin
+
+Through the `disable` configuration, you can add a new plugin with disabled status and the request will not go through the plugin. This feature is used in the APISIX Dashboard.
Review Comment:
done
##########
apisix/plugin.lua:
##########
@@ -761,8 +770,11 @@ local function check_single_plugin_schema(name, plugin_conf, schema_type, skip_d
end
if plugin_obj.check_schema then
- local disable = plugin_conf.disable
- plugin_conf.disable = nil
+ local disable = check_disable(plugin_conf)
+ if disable ~= nil then
+ plugin_conf._meta.disable = nil
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] tzssangglass commented on pull request #7707: change: move the disable to _meta
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on PR #7707:
URL: https://github.com/apache/apisix/pull/7707#issuecomment-1217595590
> Need update doc here: [https://github.com/apache/apisix/blob/master/docs/en/latest/terminology/plugin.md#plugin-common-configuration](https://github.com/apache/apisix/blob/master/docs/en/latest/terminology/plugin.md?rgh-link-date=2022-08-17T06%3A31%3A11Z#plugin-common-configuration)
updated
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] spacewander merged pull request #7707: change: move the disable to _meta
Posted by GitBox <gi...@apache.org>.
spacewander merged PR #7707:
URL: https://github.com/apache/apisix/pull/7707
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [apisix] soulbird commented on pull request #7707: change: move the disable to _meta
Posted by GitBox <gi...@apache.org>.
soulbird commented on PR #7707:
URL: https://github.com/apache/apisix/pull/7707#issuecomment-1217518749
Need update doc here: https://github.com/apache/apisix/blob/master/docs/en/latest/terminology/plugin.md#plugin-common-configuration
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org