aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/RedisFactory.php
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-07-23 09:53:06 +0200
committerVincent Petry <vincent@nextcloud.com>2021-07-23 09:53:06 +0200
commit41ddbec40f1b2c59a68464efc8ba7b127cda444e (patch)
tree65f0fa8dba148398dbe9e9a1fb5a1abf6858ece0 /lib/private/RedisFactory.php
parent97976746b8096de61908c8abc8b4d764bc6bdbcd (diff)
downloadnextcloud-server-41ddbec40f1b2c59a68464efc8ba7b127cda444e.tar.gz
nextcloud-server-41ddbec40f1b2c59a68464efc8ba7b127cda444e.zip
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>
Diffstat (limited to 'lib/private/RedisFactory.php')
-rw-r--r--lib/private/RedisFactory.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/private/RedisFactory.php b/lib/private/RedisFactory.php
index 7609a75d52d..8160f2569e0 100644
--- a/lib/private/RedisFactory.php
+++ b/lib/private/RedisFactory.php
@@ -51,10 +51,6 @@ class RedisFactory {
? $this->config->getValue('redis.cluster', [])
: $this->config->getValue('redis', []);
- if (empty($config)) {
- throw new \Exception('Redis config is empty');
- }
-
if ($isCluster && !class_exists('RedisCluster')) {
throw new \Exception('Redis Cluster support is not available');
}
@@ -86,6 +82,10 @@ class RedisFactory {
// cluster config
if ($isCluster) {
+ if (!isset($config['seeds'])) {
+ throw new \Exception('Redis cluster config is missing the "seeds" attribute');
+ }
+
// Support for older phpredis versions not supporting connectionParameters
if ($connectionParameters !== null) {
$this->instance = new \RedisCluster(null, $config['seeds'], $timeout, $readTimeout, false, $auth, $connectionParameters);