Skip to content

feat(redis): enhance connection setup with username and database handling#1441

Merged
Artuomka merged 1 commit into
mainfrom
backend_redis_credentials
Nov 20, 2025
Merged

feat(redis): enhance connection setup with username and database handling#1441
Artuomka merged 1 commit into
mainfrom
backend_redis_credentials

Conversation

@Artuomka

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings November 20, 2025 13:34
@Artuomka Artuomka merged commit f265f9e into main Nov 20, 2025
12 checks passed
@Artuomka Artuomka deleted the backend_redis_credentials branch November 20, 2025 13:34

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enhances Redis connection setup by adding support for username authentication and database selection. These additions align Redis connections with standard authentication patterns used by other database adapters in the codebase.

  • Added username field to Redis client configuration for authentication
  • Added database field to support Redis database selection (0-15)
  • Implemented database value parsing from connection parameters
Comments suppressed due to low confidence (1)

shared-code/src/data-access-layer/data-access-objects/data-access-object-redis.ts:666

  • This guard always evaluates to false.
              result = rowValue === null || rowValue === undefined || rowValue === '';

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +699 to +703
const database = this.connection.database
? Number(this.connection.database)
? Number(this.connection.database)
: 0
: 0;

Copilot AI Nov 20, 2025

Copy link

Choose a reason for hiding this comment

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

The nested ternary logic for database conversion is flawed. When this.connection.database is "0", Number("0") evaluates to 0 (falsy), causing the condition on line 700 to fail and incorrectly fall through to the default value of 0 on line 702.

This should be simplified to properly handle the conversion:

const database = this.connection.database ? Number(this.connection.database) : 0;

Or if you need to handle invalid numeric strings:

const parsedDb = Number(this.connection.database);
const database = !isNaN(parsedDb) ? parsedDb : 0;
Suggested change
const database = this.connection.database
? Number(this.connection.database)
? Number(this.connection.database)
: 0
: 0;
const parsedDb = Number(this.connection.database);
const database = !isNaN(parsedDb) ? parsedDb : 0;

Copilot uses AI. Check for mistakes.
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.

2 participants