Skip to content

Commit 5752c50

Browse files
Allow 'databases' server config option to be set by ENV (#159)
This is quite specific to my needs, but possibly useful for others. My setup is PhpRedisAdmin running in Docker on ECS Fargate connnecting to Redis Elasticache. AWS Elasticache has a restricted CONFIG command so you can't get the databases. This change allows me to set the databases in the Task Definition in ECS.
1 parent 7e4bc6c commit 5752c50

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

includes/config.environment.inc.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
$server_host = getenv($prefix . 'HOST');
2525
$server_port = getenv($prefix . 'PORT');
2626
$server_auth = getenv($prefix . 'AUTH');
27+
$server_databases = getenv($prefix . 'DATABASES');
2728

2829
if (empty($server_host)) {
2930
break;
@@ -51,6 +52,10 @@
5152
if (!empty($server_auth)) {
5253
$config['servers'][$i-1]['auth'] = $server_auth;
5354
}
55+
56+
if (!empty($server_databases)) {
57+
$config['servers'][$i-1]['databases'] = $server_databases;
58+
}
5459

5560
$i++;
5661
}

0 commit comments

Comments
 (0)