Skip to content

Commit

Permalink
🔧 Improve dynamic config
Browse files Browse the repository at this point in the history
Signed-off-by: mathieu.brunot <[email protected]>
  • Loading branch information
madmath03 authored and mriedmann committed Sep 5, 2020
1 parent e336126 commit ce3c349
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions humhub/protected/config/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,28 @@
*
* @see https://docs.humhub.org/docs/admin/redis
*/
if (getenv('HUMHUB_CACHE_CLASS') == 'yii\redis\Cache') {
if (!empty(getenv('HUMHUB_REDIS_HOSTNAME'))) {
$common['components']['redis'] = [
'class' => 'yii\redis\Connection',
'hostname' => getenv('HUMHUB_REDIS_HOSTNAME', true) ? getenv('HUMHUB_REDIS_HOSTNAME') : 'redis',
'hostname' => getenv('HUMHUB_REDIS_HOSTNAME'),
'port' => getenv('HUMHUB_REDIS_PORT', true) ? getenv('HUMHUB_REDIS_PORT') : 6379,
'database' => 0,
];
if (getenv('HUMHUB_REDIS_PASSWORD', true)) {
$common['components']['redis']['password'] = getenv('HUMHUB_REDIS_PASSWORD');
}

$common['components']['cache'] = [
'class' => 'yii\redis\Cache',
];
if (getenv('HUMHUB_CACHE_CLASS')) {
$common['components']['cache'] = [
'class' => getenv('HUMHUB_CACHE_CLASS'),
];
}

$common['components']['queue'] = [
'class' => 'humhub\modules\queue\driver\Redis',
];
if (!empty(getenv('HUMHUB_QUEUE_CLASS'))) {
$common['components']['queue'] = [
'class' => getenv('HUMHUB_QUEUE_CLASS'),
];
}

if (getenv('HUMHUB_PUSH_URL', true) && getenv('HUMHUB_PUSH_JWT_TOKEN', true)) {
$common['components']['push'] = [
Expand Down

0 comments on commit ce3c349

Please sign in to comment.