Skip to content

Commit 5cca2d1

Browse files
authored
Merge pull request #509 from Toflar/fix-password-auth-predis
Fixed password auth for predis
2 parents edcca56 + 1e39856 commit 5cca2d1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: pkg/redis/PRedis.php

+6-3
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ public function __construct(array $config)
3434
'persisted' => false,
3535
'database' => 0,
3636
], $config);
37+
38+
// Predis client wants the key to be named "password"
39+
$this->config['password'] = $this->config['pass'];
40+
unset($this->config['pass']);
3741
}
3842

3943
/**
@@ -91,9 +95,8 @@ public function connect(): void
9195

9296
$this->redis = new Client($this->config, ['exceptions' => true]);
9397

94-
if ($this->config['pass']) {
95-
$this->redis->auth($this->config['pass']);
96-
}
98+
// No need to pass "auth" here because Predis already handles
99+
// this internally
97100

98101
$this->redis->connect();
99102
}

0 commit comments

Comments
 (0)