shreemaan-abhishek commented on code in PR #10866:
URL: https://github.com/apache/apisix/pull/10866#discussion_r1470571896
##########
apisix/plugins/limit-conn.lua:
##########
@@ -19,18 +19,95 @@ local limit_conn = require("apisix.plugins.limit-conn.init")
local plugin_name = "limit-conn"
+
+local policy_to_additional_properties = {
+ redis = {
+ properties = {
+ redis_host = {
+ type = "string", minLength = 2
+ },
+ redis_port = {
+ type = "integer", minimum = 1, default = 6379,
+ },
+ redis_username = {
+ type = "string", minLength = 1,
+ },
+ redis_password = {
+ type = "string", minLength = 0,
+ },
+ redis_prefix = {
+ type = "string", minLength = 0, default = "limit_conn",
pattern = "^[0-9a-zA-Z|_]+$"
+ },
+ redis_database = {
+ type = "integer", minimum = 0, default = 0,
+ },
+ redis_timeout = {
+ type = "integer", minimum = 1, default = 1000,
+ },
+ redis_ssl = {
+ type = "boolean", default = false,
+ },
+ redis_ssl_verify = {
+ type = "boolean", default = false,
+ },
+ },
+ required = {"redis_host"},
+ },
+ ["shared-dict"] = {
+ properties = {
+ },
+ },
+ ["redis-cluster"] = {
+ properties = {
+ redis_cluster_nodes = {
+ type = "array",
+ minItems = 2,
+ items = {
+ type = "string", minLength = 2, maxLength = 100
+ },
+ },
+ redis_password = {
+ type = "string", minLength = 0,
+ },
+ redis_prefix = {
+ type = "string", minLength = 0, default = "limit_conn",
pattern = "^[0-9a-zA-Z|_]+$"
+ },
+ redis_timeout = {
+ type = "integer", minimum = 1, default = 1000,
+ },
+ redis_cluster_name = {
+ type = "string",
+ },
+ redis_cluster_ssl = {
+ type = "boolean", default = false,
+ },
+ redis_cluster_ssl_verify = {
+ type = "boolean", default = false,
+ },
+ },
+ required = {"redis_cluster_nodes", "redis_cluster_name"},
+ },
+}
local schema = {
type = "object",
properties = {
- conn = {type = "integer", exclusiveMinimum = 0},
+ conn = {type = "integer", exclusiveMinimum = 0}, --
limit.conn max
burst = {type = "integer", minimum = 0},
default_conn_delay = {type = "number", exclusiveMinimum = 0},
only_use_default_delay = {type = "boolean", default = false},
- key = {type = "string"},
- key_type = {type = "string",
+ key = {
+ type = "string"
+ },
+ key_type = {
+ type = "string",
enum = {"var", "var_combination"},
default = "var",
},
+ policy = {
+ type = "string",
+ enum = {"redis", "redis-cluster", "shared-dict"},
+ default = "shared-dict",
Review Comment:
replace `shared-dict` with `local` and please make changes elsewhere to
ensure consistency in implementation with the `limit-count` redis and
redis-cluster.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]