Skip to content

Commit bbe40da

Browse files
committed
Add support for redis acl
1 parent cc2381a commit bbe40da

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Redis:
8383
- `PCA_REDIS_0_HOST` Redis host. Optional, when a `path` is specified.
8484
- `PCA_REDIS_0_PORT` Redis port. Optional, when the default port is used.
8585
- `PCA_REDIS_0_DATABASE` Redis database. Optional.
86+
- `PCA_REDIS_0_USERNAME` Redis username. Optional, requires Redis >= 6.0.
8687
- `PCA_REDIS_0_PASSWORD` Redis password. Optional.
8788
- `PCA_REDIS_0_PATH` Redis unix domain socket. Optional.
8889

@@ -99,6 +100,7 @@ To add another server, add the same environment variables, but change 0 to 1 (2
99100

100101
- PHP >= 7.4
101102
- redis, memcache(d), opcache or apcu php extensions (if none of them is installed, only the Server tab will be available)
103+
- Memcached server >= 1.4.18
102104

103105
## Testing
104106

config.dist.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
'host' => '127.0.0.1', // Optional, when a path is specified
2727
'port' => 6379, // Optional, when the default port is used
2828
//'database' => 0, // Optional
29+
//'username' => '', // Optional, requires Redis >= 6.0
2930
//'password' => '', // Optional
3031
//'path' => '/var/run/redis/redis-server.sock', // Optional
3132
],

src/Dashboards/Redis/RedisDashboard.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,13 @@ private function connect(array $server): Redis {
9696

9797
try {
9898
if (isset($server['password'])) {
99-
$redis->auth($server['password']);
99+
if (isset($server['username'])) {
100+
$credentials = [$server['username'], $server['password']];
101+
} else {
102+
$credentials = $server['password'];
103+
}
104+
105+
$redis->auth($credentials);
100106
}
101107
} catch (RedisException $e) {
102108
throw new DashboardException(

0 commit comments

Comments
 (0)