<?php
+// REDIS - Split out configuration into an array
+if (env('REDIS_SERVERS', false)) {
+ $redisServerKeys = ['host', 'port', 'database'];
+ $redisServers = explode(',', trim(env('REDIS_SERVERS', '127.0.0.1:6379:0'), ','));
+ $redisConfig = [
+ 'cluster' => env('REDIS_CLUSTER', false)
+ ];
+ foreach ($redisServers as $index => $redisServer) {
+ $redisServerName = ($index === 0) ? 'default' : 'redis-server-' . $index;
+ $redisServerDetails = explode(':', $redisServer);
+ if (count($redisServerDetails) < 2) $redisServerDetails[] = '6379';
+ if (count($redisServerDetails) < 3) $redisServerDetails[] = '0';
+ $redisConfig[$redisServerName] = array_combine($redisServerKeys, $redisServerDetails);
+ }
+}
+
+$mysql_host = env('DB_HOST', 'localhost');
+$mysql_host_exploded = explode(':', $mysql_host);
+$mysql_port = env('DB_PORT', 3306);
+if (count($mysql_host_exploded) > 1) {
+ $mysql_host = $mysql_host_exploded[0];
+ $mysql_port = intval($mysql_host_exploded[1]);
+}
+
return [
/*
'mysql' => [
'driver' => 'mysql',
- 'host' => env('DB_HOST', 'localhost'),
+ 'host' => $mysql_host,
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
- 'charset' => 'utf8',
- 'collation' => 'utf8_unicode_ci',
+ 'port' => $mysql_port,
+ 'charset' => 'utf8mb4',
+ 'collation' => 'utf8mb4_unicode_ci',
'prefix' => '',
'strict' => false,
],
'mysql_testing' => [
'driver' => 'mysql',
- 'host' => 'localhost',
+ 'host' => '127.0.0.1',
'database' => 'bookstack-test',
- 'username' => 'bookstack-test',
- 'password' => 'bookstack-test',
+ 'username' => env('MYSQL_USER', 'bookstack-test'),
+ 'password' => env('MYSQL_PASSWORD', 'bookstack-test'),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
|
*/
- 'redis' => [
-
- 'cluster' => false,
-
- 'default' => [
- 'host' => '127.0.0.1',
- 'port' => 6379,
- 'database' => 0,
- ],
-
- ],
+ 'redis' => env('REDIS_SERVERS', false) ? $redisConfig : [],
];