2021-08-07 11:05:20 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
2022-01-20 20:16:37 +01:00
|
|
|
use Shlinkio\Shlink\Core\Config\EnvVars;
|
2021-08-07 11:05:20 +02:00
|
|
|
|
|
|
|
return (static function (): array {
|
2022-04-23 12:44:17 +02:00
|
|
|
$redisServers = EnvVars::REDIS_SERVERS->loadFromEnv();
|
2022-07-26 10:17:50 +02:00
|
|
|
$pubSub = [
|
|
|
|
'redis' => [
|
|
|
|
'pub_sub_enabled' => $redisServers !== null && EnvVars::REDIS_PUB_SUB_ENABLED->loadFromEnv(false),
|
|
|
|
],
|
|
|
|
];
|
2021-08-07 11:05:20 +02:00
|
|
|
|
2022-01-01 18:40:48 +01:00
|
|
|
return match ($redisServers) {
|
2022-07-26 10:17:50 +02:00
|
|
|
null => $pubSub,
|
2021-08-07 11:05:20 +02:00
|
|
|
default => [
|
|
|
|
'cache' => [
|
|
|
|
'redis' => [
|
|
|
|
'servers' => $redisServers,
|
2022-04-23 12:44:17 +02:00
|
|
|
'sentinel_service' => EnvVars::REDIS_SENTINEL_SERVICE->loadFromEnv(),
|
2021-08-07 11:05:20 +02:00
|
|
|
],
|
|
|
|
],
|
2022-07-26 10:17:50 +02:00
|
|
|
...$pubSub,
|
2021-08-07 11:05:20 +02:00
|
|
|
],
|
|
|
|
};
|
|
|
|
})();
|