Skip to content

Commit 41ddbec

Browse files
committed
Allow empty Redis config
When Redis config is empty, use defaults. However when a Redis cluster config is specified, the "seeds" attribute is mandatory. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
1 parent 9797674 commit 41ddbec

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/private/RedisFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ private function create() {
5151
? $this->config->getValue('redis.cluster', [])
5252
: $this->config->getValue('redis', []);
5353

54-
if (empty($config)) {
55-
throw new \Exception('Redis config is empty');
56-
}
57-
5854
if ($isCluster && !class_exists('RedisCluster')) {
5955
throw new \Exception('Redis Cluster support is not available');
6056
}
@@ -86,6 +82,10 @@ private function create() {
8682

8783
// cluster config
8884
if ($isCluster) {
85+
if (!isset($config['seeds'])) {
86+
throw new \Exception('Redis cluster config is missing the "seeds" attribute');
87+
}
88+
8989
// Support for older phpredis versions not supporting connectionParameters
9090
if ($connectionParameters !== null) {
9191
$this->instance = new \RedisCluster(null, $config['seeds'], $timeout, $readTimeout, false, $auth, $connectionParameters);

0 commit comments

Comments
 (0)