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/09/23 10:07:25 UTC

[GitHub] [apisix] tzssangglass opened a new pull request #5126: chore(plugin): add scope equals to global attribute for some plugins

tzssangglass opened a new pull request #5126:
URL: https://github.com/apache/apisix/pull/5126


   Signed-off-by: tzssangglass <tz...@gmail.com>
   
   ### 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. -->
   
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features have been added?
   * [x] Have you added corresponding test cases?
   * [ ] 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 #5126: chore(plugin): add scope equals to global attribute for some plugins

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #5126:
URL: https://github.com/apache/apisix/pull/5126#discussion_r714677763



##########
File path: apisix/admin/plugins.lua
##########
@@ -48,6 +48,7 @@ function _M.get(name)
             metadata_schema = true,
             consumer_schema = true,
             type = true,
+            scope = true,

Review comment:
       Let's update `/v1/schema` too: https://github.com/apache/apisix/blob/master/docs/en/latest/control-api.md#get-v1schema




-- 
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 change in pull request #5126: chore(plugin): add scope equals to global attribute for some plugins

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on a change in pull request #5126:
URL: https://github.com/apache/apisix/pull/5126#discussion_r715258970



##########
File path: t/control/schema.t
##########
@@ -98,3 +98,48 @@ __DATA__
     }
 --- response_body
 passed
+
+
+
+=== TEST 2: confirm the scope of plugin
+--- yaml_config
+apisix:
+  node_listen: 1984
+  admin_key: null
+plugins:
+  - batch-requests
+  - error-log-logger
+  - server-info
+  - example-plugin
+  - node-status
+--- config
+    location /t {
+        content_by_lua_block {
+            local json = require("toolkit.json")
+            local t = require("lib.test_admin").test
+
+            local code, message, res = t('/v1/schema',
+                ngx.HTTP_GET
+            )
+
+            if code >= 300 then
+                ngx.status = code
+                ngx.say(message)
+                return
+            end
+
+            res = json.decode(res)
+            local global_plugins = {}
+            local plugins = res["plugins"]
+            for k, v in pairs(plugins) do
+                if v.scope == "global" then
+                    global_plugins[k] = v.scope
+                end
+            end
+            ngx.say(json.encode(global_plugins))
+        }
+    }
+--- response_body
+{"batch-requests":"global","error-log-logger":"global","node-status":"global","server-info":"global"}
+--- no_error_log

Review comment:
       done




-- 
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 #5126: chore(plugin): add scope equals to global attribute for some plugins

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on pull request #5126:
URL: https://github.com/apache/apisix/pull/5126#issuecomment-925804306


   > Also need to update plugin node-status.
   
   The doc for node-status needs to be update: https://github.com/apache/apisix/blob/master/docs/en/latest/plugins/node-status.md#how-to-enable
   
   the example says to enable node-status on route.


-- 
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 #5126: chore(plugin): add scope equals to global attribute for some plugins

Posted by GitBox <gi...@apache.org>.
spacewander commented on a change in pull request #5126:
URL: https://github.com/apache/apisix/pull/5126#discussion_r715250580



##########
File path: t/control/schema.t
##########
@@ -98,3 +98,48 @@ __DATA__
     }
 --- response_body
 passed
+
+
+
+=== TEST 2: confirm the scope of plugin
+--- yaml_config
+apisix:
+  node_listen: 1984
+  admin_key: null
+plugins:
+  - batch-requests
+  - error-log-logger
+  - server-info
+  - example-plugin
+  - node-status
+--- config
+    location /t {
+        content_by_lua_block {
+            local json = require("toolkit.json")
+            local t = require("lib.test_admin").test
+
+            local code, message, res = t('/v1/schema',
+                ngx.HTTP_GET
+            )
+
+            if code >= 300 then
+                ngx.status = code
+                ngx.say(message)
+                return
+            end
+
+            res = json.decode(res)
+            local global_plugins = {}
+            local plugins = res["plugins"]
+            for k, v in pairs(plugins) do
+                if v.scope == "global" then
+                    global_plugins[k] = v.scope
+                end
+            end
+            ngx.say(json.encode(global_plugins))
+        }
+    }
+--- response_body
+{"batch-requests":"global","error-log-logger":"global","node-status":"global","server-info":"global"}
+--- no_error_log

Review comment:
       The no_error_log is already set in the file level




-- 
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 #5126: chore(plugin): add scope equals to global attribute for some plugins

Posted by GitBox <gi...@apache.org>.
spacewander merged pull request #5126:
URL: https://github.com/apache/apisix/pull/5126


   


-- 
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 change in pull request #5126: chore(plugin): add scope equals to global attribute for some plugins

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on a change in pull request #5126:
URL: https://github.com/apache/apisix/pull/5126#discussion_r714812088



##########
File path: apisix/admin/plugins.lua
##########
@@ -48,6 +48,7 @@ function _M.get(name)
             metadata_schema = true,
             consumer_schema = true,
             type = true,
+            scope = true,

Review comment:
       done




-- 
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