This commit is contained in:
2026-03-06 00:07:20 +01:00
parent 2ccf71915f
commit 9dfcbab710
3 changed files with 8 additions and 8 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'] ?? 'redis');
$port = (int)($redis['port'] ?? 6379);
$password = (string)($redis['password'] ?? '');
$db = (int)($redis['db'] ?? 0);
$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));
return new \App\RedisClient($host, $port, $password !== '' ? $password : null, $db);
});