Skip to content

Commit ead6776

Browse files
authored
fix: 修复默认连接配置异常 (#5)
1 parent 0e0175e commit ead6776

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Redis.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@ public function __construct(array $config = [])
2121

2222
$options = [
2323
'parameters' => [
24-
'password' => $config['password'] ?? getenv('REDIS_PASSWORD') ?? '',
25-
'database' => $config['database'] ?? getenv('REDIS_DB') ?? 0,
24+
'password' => $config['password'] ?? getenv('REDIS_PASSWORD') ?: '',
25+
'database' => $config['database'] ?? getenv('REDIS_DB') ?: 0,
2626
],
2727
];
2828
$this->client = new Client([
2929
'scheme' => 'tcp',
30-
'host' => $config['host'] ?? getenv('REDIS_HOST') ?? '127.0.0.1',
31-
'port' => $config['port'] ?? getenv('REDIS_PORT') ?? 6379,
30+
'host' => $config['host'] ?? getenv('REDIS_HOST') ?: '127.0.0.1',
31+
'port' => $config['port'] ?? getenv('REDIS_PORT') ?: 6379,
3232
], $options);
3333
}
3434

0 commit comments

Comments
 (0)