This commit is contained in:
2026-03-06 00:38:05 +01:00
parent 98888d6900
commit e477c336d9
3 changed files with 6 additions and 6 deletions

View File

@@ -35,10 +35,10 @@ $mm->registerFunction($moduleName, 'pdo', function () use ($moduleName): \PDO {
$mm->registerFunction($moduleName, 'redis', function () use ($moduleName) {
$settings = modules()->settings($moduleName);
$redis = (array)($settings['redis'] ?? []);
$host = (string)($redis['host'] ?? getenv('PI_CONTROL_REDIS_HOST') ?: 'redis');
$port = (int)($redis['port'] ?? (getenv('PI_CONTROL_REDIS_PORT') !== false ? (int)getenv('PI_CONTROL_REDIS_PORT') : 6379));
$password = (string)($redis['password'] ?? getenv('PI_CONTROL_REDIS_PASSWORD') ?: '');
$db = (int)($redis['db'] ?? (getenv('PI_CONTROL_REDIS_DB') !== false ? (int)getenv('PI_CONTROL_REDIS_DB') : 0));
$host = (string)($redis['host'] ?? ($settings['redis.host'] ?? getenv('PI_CONTROL_REDIS_HOST') ?: 'redis'));
$port = (int)($redis['port'] ?? ($settings['redis.port'] ?? (getenv('PI_CONTROL_REDIS_PORT') !== false ? (int)getenv('PI_CONTROL_REDIS_PORT') : 6379)));
$password = (string)($redis['password'] ?? ($settings['redis.password'] ?? getenv('PI_CONTROL_REDIS_PASSWORD') ?: ''));
$db = (int)($redis['db'] ?? ($settings['redis.db'] ?? (getenv('PI_CONTROL_REDIS_DB') !== false ? (int)getenv('PI_CONTROL_REDIS_DB') : 0)));
return new \App\RedisClient($host, $port, $password !== '' ? $password : null, $db);
});