Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AUTH support fails on databases beyond 0 #8

Closed
fgm opened this issue May 24, 2021 · 2 comments
Closed

AUTH support fails on databases beyond 0 #8

fgm opened this issue May 24, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@fgm
Copy link
Owner

fgm commented May 24, 2021

Cause: when Redigo connects to a Redis server,

  • if the requested DB is 0, it only connects, and the AUTH command is applied when building the AuthConn afterwards
  • if the requested DB is not 0, it first connects, then uses SELECT, which fails before returning, before the AuthConn is built

Solution:

  • either modify the DSN in all cases based on the -u/-p flags to include auth, allowing the removal of the AuthConn
  • or modify the DSN to connect to DB 0, build the AuthConn, and SELECT the requested DB afterwards.

The first approach seems more elegant, albeit a bit more fragile as it depends on an undocumented behavior of Redigo.

@fgm fgm added the bug Something isn't working label May 24, 2021
@fgm
Copy link
Owner Author

fgm commented May 25, 2021

Underlying issue in the way Redigo handles DSNs: gomodule/redigo#561

@fgm
Copy link
Owner Author

fgm commented Feb 18, 2024

Fixed by gomodule/redigo#566

@fgm fgm closed this as completed Feb 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant