Skip to content

Commit

Permalink
feat(response-ratelimiting): add support for secret rotation with red…
Browse files Browse the repository at this point in the history
…is connection

Signed-off-by: Aapo Talvensaari <[email protected]>
  • Loading branch information
bungle committed Sep 20, 2023
1 parent 94fbf7e commit 3c513f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG/unreleased/kong/10570.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
message: "**response-ratelimiting**: add support for secret rotation with redis connection "
type: feature
scope: Plugin
prs:
- 10570

8 changes: 6 additions & 2 deletions kong/plugins/response-ratelimiting/policies/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ local function get_redis_connection(conf)
if is_present(conf.redis_password) then
local ok, err
if is_present(conf.redis_username) then
ok, err = red:auth(conf.redis_username, conf.redis_password)
ok, err = kong.vault.try(function(cfg)
return red:auth(cfg.redis_username, cfg.redis_password)
end, conf)
else
ok, err = red:auth(conf.redis_password)
ok, err = kong.vault.try(function(cfg)
return red:auth(cfg.redis_password)
end, conf)
end
if not ok then
kong.log.err("failed to auth Redis: ", err)
Expand Down

0 comments on commit 3c513f4

Please sign in to comment.