2021-11-30 11:20:42 +01:00
|
|
|
<?php
|
2026-01-09 15:18:43 +01:00
|
|
|
if (!getenv('REDIS_HOST_2')) {
|
2021-11-30 11:20:42 +01:00
|
|
|
$CONFIG = array(
|
|
|
|
|
'memcache.distributed' => '\OC\Memcache\Redis',
|
|
|
|
|
'memcache.locking' => '\OC\Memcache\Redis',
|
|
|
|
|
'redis' => array(
|
|
|
|
|
'host' => getenv('REDIS_HOST'),
|
|
|
|
|
'password' => (string) getenv('REDIS_HOST_PASSWORD'),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
2025-12-08 15:36:02 +01:00
|
|
|
if (getenv('REDIS_PORT')) {
|
|
|
|
|
$CONFIG['redis']['port'] = (int) getenv('REDIS_PORT');
|
2021-11-30 11:20:42 +01:00
|
|
|
}
|
2024-06-21 10:52:47 +02:00
|
|
|
|
2024-08-09 16:36:16 +02:00
|
|
|
if (getenv('REDIS_DB_INDEX')) {
|
2024-06-21 10:52:47 +02:00
|
|
|
$CONFIG['redis']['dbindex'] = (int) getenv('REDIS_DB_INDEX');
|
|
|
|
|
}
|
2025-01-13 11:15:29 +01:00
|
|
|
|
2026-01-09 15:18:43 +01:00
|
|
|
if (getenv('REDIS_USER_AUTH')) {
|
2025-01-14 14:25:17 +01:00
|
|
|
$CONFIG['redis']['user'] = str_replace("&auth[]=", "", getenv('REDIS_USER_AUTH'));
|
2025-01-13 11:15:29 +01:00
|
|
|
}
|
2026-01-09 15:18:43 +01:00
|
|
|
} else {
|
|
|
|
|
$CONFIG = array(
|
|
|
|
|
'memcache.distributed' => '\OC\Memcache\Redis',
|
|
|
|
|
'memcache.locking' => '\OC\Memcache\Redis',
|
|
|
|
|
'redis.cluster' => array(
|
|
|
|
|
'password' => (string) getenv('REDIS_HOST_PASSWORD'),
|
|
|
|
|
'timeout' => 0.0,
|
|
|
|
|
'read_timeout' => 0.0,
|
|
|
|
|
'failover_mode' => \RedisCluster::FAILOVER_ERROR,
|
|
|
|
|
'seeds' => array(
|
|
|
|
|
getenv('REDIS_HOST') . ':' . (string)getenv('REDIS_PORT'),
|
|
|
|
|
getenv('REDIS_HOST_2') . ':' . (string)getenv('REDIS_PORT_2'),
|
|
|
|
|
getenv('REDIS_HOST_3') . ':' . (string)getenv('REDIS_PORT_3'),
|
|
|
|
|
getenv('REDIS_HOST_4') . ':' . (string)getenv('REDIS_PORT_4'),
|
|
|
|
|
getenv('REDIS_HOST_5') . ':' . (string)getenv('REDIS_PORT_5'),
|
|
|
|
|
getenv('REDIS_HOST_6') . ':' . (string)getenv('REDIS_PORT_6'),
|
|
|
|
|
getenv('REDIS_HOST_7') . ':' . (string)getenv('REDIS_PORT_7'),
|
|
|
|
|
getenv('REDIS_HOST_8') . ':' . (string)getenv('REDIS_PORT_8'),
|
|
|
|
|
getenv('REDIS_HOST_9') . ':' . (string)getenv('REDIS_PORT_9'),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (getenv('REDIS_USER_AUTH')) {
|
|
|
|
|
$CONFIG['redis.cluster']['user'] = str_replace("&auth[]=", "", getenv('REDIS_USER_AUTH'));
|
|
|
|
|
}
|
2021-11-30 11:20:42 +01:00
|
|
|
}
|