Updated config to read redis from config.redis

This commit is contained in:
Alejandro Celaya 2020-01-05 16:45:14 +01:00
parent abe54c67d8
commit 4fadd523f1
4 changed files with 23 additions and 12 deletions

View file

@ -1,13 +1,16 @@
<?php
declare(strict_types=1);
return [
'redis' => [
'servers' => 'tcp://shlink_redis:6379',
// 'servers' => [
// 'tcp://shlink_redis:6379',
// ],
'cache' => [
'redis' => [
'servers' => 'tcp://shlink_redis:6379',
// 'servers' => [
// 'tcp://shlink_redis:6379',
// ],
],
],
'dependencies' => [

View file

@ -62,6 +62,12 @@ $helper = new class {
$webhooks = env('VISITS_WEBHOOKS');
return $webhooks === null ? [] : explode(',', $webhooks);
}
public function getRedisConfig(): ?array
{
$redisServers = env('REDIS_SERVERS');
return $redisServers === null ? null : ['servers' => $redisServers];
}
};
return [
@ -112,8 +118,8 @@ return [
],
],
'redis' => [
'servers' => env('REDIS_SERVERS'),
'cache' => [
'redis' => $helper->getRedisConfig(),
],
'router' => [

View file

@ -27,7 +27,7 @@ class SimplifiedConfigParser
'base_url_redirect_to' => ['not_found_redirects', 'base_path'],
'db_config' => ['entity_manager', 'connection'],
'delete_short_url_threshold' => ['delete_short_urls', 'visits_threshold'],
'redis_servers' => ['redis', 'servers'],
'redis_servers' => ['cache', 'redis', 'servers'],
'base_path' => ['router', 'base_path'],
'web_worker_num' => ['mezzio-swoole', 'swoole-http-server', 'options', 'worker_num'],
'task_worker_num' => ['mezzio-swoole', 'swoole-http-server', 'options', 'task_worker_num'],

View file

@ -97,10 +97,12 @@ class SimplifiedConfigParserTest extends TestCase
],
],
'redis' => [
'servers' => [
'tcp://1.1.1.1:1111',
'tcp://1.2.2.2:2222',
'cache' => [
'redis' => [
'servers' => [
'tcp://1.1.1.1:1111',
'tcp://1.2.2.2:2222',
],
],
],