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 2021/12/28 03:14:43 UTC
[GitHub] [apisix] spacewander opened a new pull request #5941: feat: support registering custom variable
spacewander opened a new pull request #5941:
URL: https://github.com/apache/apisix/pull/5941
### What this PR does / why we need it:
<!--- Why is this change required? What problem does it solve? -->
<!--- If it fixes an open issue, please link to the issue here. -->
Fix #5634
### Pre-submission checklist:
<!--
Please follow the requirements:
1. Use Draft if the PR is not ready to be reviewed
2. Test is required for the feat/fix PR, unless you have a good reason
3. Doc is required for the feat PR
4. Use a new commit to resolve review instead of `push -f`
5. If you need to resolve merge conflicts after the PR is reviewed, please merge master but do not rebase
6. Use "request review" to notify the reviewer once you have resolved the review
-->
* [x] Did you explain what problem does this PR solve? Or what new features have been added?
* [x] Have you added corresponding test cases?
* [x] Have you modified the corresponding document?
* [x] Is this PR backward compatible? **If it is not backward compatible, please discuss on the [mailing list](https://github.com/apache/apisix/tree/master#community) first**
--
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 change in pull request #5941: feat: support registering custom variable
Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #5941:
URL: https://github.com/apache/apisix/pull/5941#discussion_r776131295
##########
File path: apisix/core/ctx.lua
##########
@@ -215,11 +215,18 @@ do
key = sub_str(key, 9)
val = get_parsed_graphql()[key]
- elseif apisix_var_names[key] then
- val = ngx.ctx.api_ctx and ngx.ctx.api_ctx[key]
-
else
- val = get_var(key, t._request)
+ local getter = apisix_var_names[key]
+ if getter then
+ if getter == true then
+ val = ngx.ctx.api_ctx and ngx.ctx.api_ctx[key]
+ else
+ val = getter(ngx.ctx.api_ctx)
Review comment:
@leslie-tsang
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] juzhiyuan commented on pull request #5941: feat: support registering custom variable
Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #5941:
URL: https://github.com/apache/apisix/pull/5941#issuecomment-1002351478
Hi @leslie-tsang, could you please have a review?
--
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] leslie-tsang commented on a change in pull request #5941: feat: support registering custom variable
Posted by GitBox <gi...@apache.org>.
leslie-tsang commented on a change in pull request #5941:
URL: https://github.com/apache/apisix/pull/5941#discussion_r776125463
##########
File path: apisix/core/ctx.lua
##########
@@ -215,11 +215,18 @@ do
key = sub_str(key, 9)
val = get_parsed_graphql()[key]
- elseif apisix_var_names[key] then
- val = ngx.ctx.api_ctx and ngx.ctx.api_ctx[key]
-
else
- val = get_var(key, t._request)
+ local getter = apisix_var_names[key]
+ if getter then
+ if getter == true then
+ val = ngx.ctx.api_ctx and ngx.ctx.api_ctx[key]
+ else
+ val = getter(ngx.ctx.api_ctx)
Review comment:
Maybe we should add a comment here, to notify developer where the `getter` from ?
--
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 #5941: feat: support registering custom variable
Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #5941:
URL: https://github.com/apache/apisix/pull/5941
--
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