Skip to content

Commit 83c6db3

Browse files
authored
Allow more parameters to be sent to Predis Client (#6)
* Allow more parameters to be sent to Predis Client I had a case where I needed to provide a password to connect to Redis and the current code did not allow it. Since everything from the Suite configuration goes to the this->config array, we can simply provide it and allow the user to set the password property This will also allow for other specific configurations * Add description for Predis functionality I added the full config to Predis' client, so the developer can pass username/password and/or other options. This commit adds some description above.
1 parent 15e614c commit 83c6db3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Codeception/Module/Redis.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,15 @@
2121
* * **`host`** (`string`, default `'127.0.0.1'`) - The Redis host
2222
* * **`port`** (`int`, default `6379`) - The Redis port
2323
* * **`database`** (`int`, no default) - The Redis database. Needs to be specified.
24+
* * **`username`** (`string`, no default) - When ACLs are enabled on Redis >= 6.0, both username and password are required for user authentication.
25+
* * **`password`** (`string`, no default) - The Redis password/secret.
2426
* * **`cleanupBefore`**: (`string`, default `'never'`) - Whether/when to flush the database:
2527
* * `suite`: at the beginning of every suite
2628
* * `test`: at the beginning of every test
2729
* * Any other value: never
2830
*
31+
* Note: The full configuration list can be found on Predis' github.
32+
*
2933
* ### Example (`unit.suite.yml`)
3034
*
3135
* ```yaml
@@ -83,11 +87,7 @@ public function _requires()
8387
public function _initialize()
8488
{
8589
try {
86-
$this->driver = new RedisDriver([
87-
'host' => $this->config['host'],
88-
'port' => $this->config['port'],
89-
'database' => $this->config['database']
90-
]);
90+
$this->driver = new RedisDriver($this->config);
9191
} catch (\Exception $e) {
9292
throw new ModuleException(
9393
__CLASS__,

0 commit comments

Comments
 (0)