refactor: simplify Redis configuration initialization

- Use RedisConfig::fromEnvironment() in LoggerInitializer
- Remove fallback logic in QueueInitializer, always use connection pool
- Make RedisConfig constructor private
- Clean up Redis connection error message
This commit is contained in:
2025-11-03 00:43:28 +01:00
parent 7a2cb0b63e
commit b070767d0a
4 changed files with 6 additions and 16 deletions

View File

@@ -12,7 +12,7 @@ use App\Framework\Config\EnvKey;
*/
final readonly class RedisConfig
{
public function __construct(
private function __construct(
public string $host = 'redis',
public int $port = 6379,
public ?string $password = null,

View File

@@ -112,7 +112,7 @@ final class RedisConnection implements RedisConnectionInterface
$this->connected = false;
throw new RedisConnectionException(
"Failed to connect to Redis ({$this->name}): " . $e->getMessage() . " with Host: {$this->config->host} and Password: {$this->config->password} should be {$_ENV['REDIS_HOST']} and {$_ENV['REDIS_PASSWORD']}",
"Failed to connect to Redis ({$this->name}): " . $e->getMessage() . " with Host: {$this->config->host} and Password: {$this->config->password}",
previous: $e
);
}