Skip to content

Commit 92f9006

Browse files
[9.x] Add username option for phpredis with redis ACL (#41683)
* Update PhpRedisConnector.php Allow to use username and password string for phpredis connection, instead of a password array. Fix laravel crash if different environement (ex: one server with ACL, one with just a password), have to edit database.php to use an array in password field. Now you can use username and password. * Update PhpRedisConnector.php * formatting * remove whitespace Co-authored-by: Taylor Otwell <[email protected]>
1 parent d89400b commit 92f9006

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Illuminate/Redis/Connectors/PhpRedisConnector.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,11 @@ protected function createClient(array $config)
8484
$this->establishConnection($client, $config);
8585

8686
if (! empty($config['password'])) {
87-
$client->auth($config['password']);
87+
if (isset($config['username']) && is_string($config['password'])) {
88+
$client->auth([$config['username'], $config['password']]);
89+
} else {
90+
$client->auth($config['password']);
91+
}
8892
}
8993

9094
if (isset($config['database'])) {

0 commit comments

Comments
 (0)