8000 Connect to RedisCluster with password auth · symfony/symfony@e873ddd · GitHub
[go: up one dir, main page]

Skip to content

Commit e873ddd

Browse files
mforbaknicolas-grekas
authored andcommitted
Connect to RedisCluster with password auth
Currently it is not possible to connect to RedisCluster with password. AUTH param is described in documentation (last example) https://symfony.com/doc/current/components/cache/adapters/redis_adapter.html#configure-the-connection but totally ignored in the code and connection fails ``` RedisAdapter::createConnection( 'redis:?host[localhost]&host[localhost:6379]&host[/var/run/redis.sock:]&auth=my-password&redis_cluster=1' ); ``` See RedisCluster usage here https://github.com/phpredis/phpredis/blob/develop/cluster.markdown#declaring-a-cluster-with-an-array-of-seeds
1 parent c971a27 commit e873ddd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Symfony/Component/Cache/Traits/RedisTrait.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ public static function createConnection($dsn, array $options = [])
228228
}
229229

230230
try {
231-
$redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent']);
231+
$redis = new $class(null, $hosts, $params['timeout'], $params['read_timeout'], (bool) $params['persistent'], $params['auth'] ?? '');
232232
} catch (\RedisClusterException $e) {
233233
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$e->getMessage());
234234
}

0 commit comments

Comments
 (0)
0