Skip to content

Commit

Permalink
feat(redis) add support for username/password auth
Browse files Browse the repository at this point in the history
lua-resty-redis supports username/password authentication:

```
local res, err = red:auth("userexample", "passexample")
if not res then
  ngx.say("failed to authenticate: ", err)
  return
end
```
  • Loading branch information
gruceo committed Aug 13, 2024
1 parent 415be3f commit 9b4cb7a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/resty/acme/storage/redis.lua
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ local function op(self, op, ...)
if not ok then
return nil, err
end

if self.auth then
local _, err = client:auth(self.auth)
local _, err
if type(self.auth) == "table" then
_, err = client:auth(self.auth.username, self.auth.password)
else
_, err = client:auth(self.auth)
end
if err then
return nil, "authentication failed " .. err
end
Expand Down

0 comments on commit 9b4cb7a

Please sign in to comment.