liuhengloveyou commented on a change in pull request #2340:
URL: https://github.com/apache/apisix/pull/2340#discussion_r502993940



##########
File path: apisix/plugins/limit-count.lua
##########
@@ -70,11 +74,29 @@ local schema = {
                             type = "string", minLength = 0,
                         },
                         redis_timeout = {
-                            type = "integer", minimum = 1,
-                            default = 1000,
+                            type = "integer", minimum = 1, default = 1000,
                         },
                     },
                     required = {"redis_host"},
+                },
+                {
+                    properties = {
+                        policy = {
+                            enum = {"redis-cluster"},

Review comment:
       I tested it with the URL you provided, and it seems to be working.
   ```
   {
       "required":[
           "count",
           "time_window",
           "key"
       ],
       "properties":{
           "time_window":{
               "minimum":0,
               "type":"integer"
           },
           "count":{
               "minimum":0,
               "type":"integer"
           },
           "rejected_code":{
               "maximum":600,
               "type":"integer",
               "default":503,
               "minimum":200
           },
           "key":{
               "enum":[
                   "remote_addr",
                   "server_addr",
                   "http_x_real_ip",
                   "http_x_forwarded_for"
               ],
               "type":"string"
           },
           "policy":{
               "type":"string",
               "default":"local",
               "enum":[
                   "local",
                   "redis",
                   "redis-cluster"
               ]
           }
       },
       "dependencies":{
           "policy":{
               "oneOf":[
                   {
                       "properties":{
                           "policy":{
                               "enum":[
                                   "local"
                               ]
                           }
                       }
                   },
                   {
                       "required":[
                           "redis_host"
                       ],
                       "properties":{
                           "policy":{
                               "enum":[
                                   "redis"
                               ]
                           },
                           "redis_host":{
                               "minLength":2,
                               "type":"string"
                           },
                           "redis_timeout":{
                               "type":"integer",
                               "default":1000,
                               "minimum":1
                           },
                           "redis_password":{
                               "minLength":0,
                               "type":"string"
                           },
                           "redis_port":{
                               "type":"integer",
                               "default":6379,
                               "minimum":1
                           }
                       }
                   },
                   {
                       "required":[
                           "redis_cluster_nodes"
                       ],
                       "properties":{
                           "redis_timeout":{
                               "type":"integer",
                               "default":1000,
                               "minimum":1
                           },
                           "redis_cluster_nodes":{
                               "items":{
                                   "minLength":2,
                                   "maxLength":100,
                                   "type":"string"
                               },
                               "type":"array",
                               "minItems":2
                           },
                           "policy":{
                               "enum":[
                                   "redis-cluster"
                               ]
                           },
                           "redis_password":{
                               "minLength":0,
                               "type":"string"
                           }
                       }
                   }
               ]
           }
       },
       "type":"object"
   }
   ```




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to