From 171e23d58f6b4caaee6b6e8203592b24e71bb924 Mon Sep 17 00:00:00 2001 From: Sanil Shrestha Date: Thu, 24 Jul 2025 10:04:46 +1000 Subject: [PATCH] feat: add Redis username authentication support - Add username config option to Redis configuration - Support both username+password and password-only auth methods - Maintain backward compatibility with existing password-only setups - Improve error messages for authentication failures Signed-off-by: Sanil Shrestha --- src/Handlers/RedisHandler.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Handlers/RedisHandler.php b/src/Handlers/RedisHandler.php index 4676436..3fcd67f 100644 --- a/src/Handlers/RedisHandler.php +++ b/src/Handlers/RedisHandler.php @@ -40,9 +40,12 @@ public function __construct(protected QueueConfig $config) if (! $this->redis->connect($config->redis['host'], ($config->redis['host'][0] === '/' ? 0 : $config->redis['port']), $config->redis['timeout'])) { throw new CriticalError('Queue: Redis connection failed. Check your configuration.'); } + if (isset($config->redis['username'], $config->redis['password']) && ! $this->redis->auth([$config->redis['username'], $config->redis['password']])) { + throw new CriticalError('Queue: Redis authentication failed. Check your username and password.'); + } if (isset($config->redis['password']) && ! $this->redis->auth($config->redis['password'])) { - throw new CriticalError('Queue: Redis authentication failed.'); + throw new CriticalError('Queue: Redis authentication failed. Check your password.'); } if (isset($config->redis['database']) && ! $this->redis->select($config->redis['database'])) {