fix: skip Redis auth when credentials are unset with unit test (#541)#545
fix: skip Redis auth when credentials are unset with unit test (#541)#545Justxd22 wants to merge 6 commits intocameri:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes Redis cache client configuration so the app does not attempt Redis AUTH when REDIS_PASSWORD is unset (and still respects REDIS_URI when provided), and adds unit tests plus a changeset to cover the expected configuration behavior.
Changes:
- Update
getCacheConfig()to build an unauthenticated Redis URL when credentials are not provided, while keepingREDIS_URIprecedence. - Add unit tests covering unauthenticated config, authenticated config, and
REDIS_URIprecedence. - Add a patch changeset documenting the fix.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/cache/client.ts |
Adjusts Redis client options generation to avoid AUTH when password is unset. |
test/unit/cache/client.spec.ts |
Adds unit coverage for the updated Redis cache config behavior. |
.changeset/thirty-turtles-design.md |
Declares a patch release for the Redis config fix. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| const port = process.env.REDIS_PORT | ||
|
|
||
| if (hasPassword) { | ||
| const username = process.env.REDIS_USER ?? 'default' |
There was a problem hiding this comment.
Is default in the Redis documentation? how does this default user come to be?
There was a problem hiding this comment.
…1-redis-auth-unset-credentials
🦋 Changeset detectedLatest commit: f5f70ca The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Description
REDIS_PASSWORDis unsetredis://host:portwhen no credentials are providedREDIS_URIprecedence when presenttest/unit/cache/client.spec.tsfor:REDIS_URI+ no passwordREDIS_URIprecedenceRelated Issue
#541
How Has This Been Tested?
npm run test:unitTypes of changes
Checklist: