Skip to content

feat: limit-count plugin supports username and ssl for redis policy#9185

Merged
juststillthinking merged 12 commits into
apache:masterfrom
simon-flury:master
Apr 20, 2023
Merged

feat: limit-count plugin supports username and ssl for redis policy#9185
juststillthinking merged 12 commits into
apache:masterfrom
simon-flury:master

Conversation

@simon-flury

@simon-flury simon-flury commented Mar 28, 2023

Copy link
Copy Markdown
Contributor

Description

I want to use username and SSL to connect the plugin limit-count to a Redis instance with policy 'Redis'.

  • For Username, it looks like possible to indicate it at line 56 of file apisix/plugins/limit-count/limit-count-redis.lua.
  • For SSL, it looks like possible to add optional parameters when it connects to Redis at line 47 of file apisix/plugins/limit-count/limit-count-redis.lua.

Fixes #9175

Checklist

  • I have explained the need for this PR and the problem it solves
  • 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 first)

@juststillthinking

Copy link
Copy Markdown
Contributor

Hi @simon-flury, Test cases are needed

@simon-flury

Copy link
Copy Markdown
Contributor Author

Hi @monkeyDluffy6017, i add tests, thks

Comment thread docs/zh/latest/plugins/limit-count.md Outdated
Comment thread docs/en/latest/plugins/limit-count.md Outdated
Comment thread apisix/plugins/limit-count/init.lua Outdated
Comment thread docs/en/latest/plugins/limit-count.md Outdated
Comment thread apisix/plugins/limit-count/limit-count-redis.lua Outdated
Comment thread docs/zh/latest/plugins/limit-count.md Outdated
Comment thread docs/en/latest/plugins/limit-count.md Outdated
Comment thread t/plugin/limit-count-redis3.t Outdated
@juststillthinking

Copy link
Copy Markdown
Contributor

@soulbird @leslie-tsang @kingluo please help to review this PR

ssl_verify = conf.redis_ssl_verify
}

local ok, err = red:connect(conf.redis_host, conf.redis_port or 6379, sock_opts)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
local ok, err = red:connect(conf.redis_host, conf.redis_port or 6379, sock_opts)
local ok, err = red:connect(conf.redis_host, conf.redis_port, sock_opts)

It seems that we don't need a default value because it is already defined in the schema.

@juststillthinking
juststillthinking merged commit 41dc764 into apache:master Apr 20, 2023
@simon-flury

simon-flury commented Apr 27, 2023 via email

Copy link
Copy Markdown
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: As a user, I want to use username and SSL to connect the plugin limit-count to a Redis instance

5 participants