Ensure phpRedmin works without login

This commit is contained in:
cytopia 2020-11-07 16:41:02 +01:00
parent 9179683f18
commit 9ff5006d1a
No known key found for this signature in database
GPG Key ID: 6D56EDB8695128A2
2 changed files with 78 additions and 1 deletions

View File

@ -5,7 +5,7 @@ class RedisDb extends Redis
{
$this->connect($config['host'], $config['port']);
if (isset($config['password'])) {
if (isset($config['password']) && strlen($config['password'])>0) {
$this->auth($config['password']);
}

View File

@ -65,6 +65,83 @@ Have a look at the GitHub issues and see if you can implement any features reque
### Vendors
#### Upgrade phpRedmin
phpRedmin requires some adjustments to work with the Devilbox intranet. See below for files to adjust:
`config.dist.php`
```diff
+ // Check if redis is using a password
+ $REDIS_ROOT_PASSWORD = '';
+
+ $_REDIS_ARGS = getenv('REDIS_ARGS');
+ $_REDIS_PASS = preg_split("/--requirepass\s+/", $_REDIS_ARGS);
+ if (is_array($_REDIS_PASS) && count($_REDIS_PASS)) {
+ // In case the option is specified multiple times, use the last effective one.
+ $_REDIS_PASS = $_REDIS_PASS[count($_REDIS_PASS)-1];
+ if (strlen($_REDIS_PASS) > 0) {
+ $REDIS_ROOT_PASSWORD = $_REDIS_PASS;
+ }
+ }
- 'database' => array(
- 'driver' => 'redis',
- 'mysql' => array(
- 'host' => 'localhost',
- 'username' => 'root',
- 'password' => 'root'
- ),
- 'redis' => array(
- array(
- 'host' => 'localhost',
- 'port' => '6379',
- 'password' => null,
- 'database' => 0,
- 'max_databases' => 16, /* Manual configuration of max databases for Redis < 2.6 */
- 'stats' => array(
- 'enable' => 1,
- 'database' => 0,
- ),
- 'dbNames' => array( /* Name databases. key should be database id and value is the name */
- ),
- ),
- ),
- ),
+ 'database' => array(
+ 'driver' => 'redis',
+ 'mysql' => array(
+ 'host' => 'mysql',
+ 'username' => 'root',
+ 'password' => getenv('MYSQL_ROOT_PASSWORD')
+ ),
+ 'redis' => array(
+ array(
+ 'host' => 'redis',
+ 'port' => '6379',
+ 'password' => $REDIS_ROOT_PASSWORD,
+ 'database' => 0,
+ 'max_databases' => 16, /* Manual configuration of max databases for Redis < 2.6 */
+ 'stats' => array(
+ 'enable' => 1,
+ 'database' => 0,
+ ),
+ 'dbNames' => array( /* Name databases. key should be database id and value is the name */
+ ),
+ ),
+ ),
+ ),
```
`libraries/drivers/db/redis.php`
```diff
- if (isset($config['password'])) {
- $this->auth($config['password']);
- }
+ if (isset($config['password']) && strlen($config['password'])>0) {
+ $this->auth($config['password']);
+ }
```
#### Upgrade phpPgAdmin
phpPgAdmin requires some adjustments to work with the Devilbox intranet. See below for files to adjust: