4 * Database configuration options.
6 * Changes to these config files are not supported by BookStack and may break upon updates.
7 * Configuration should be altered via the `.env` file or environment variables.
8 * Do not edit this file unless you're happy to maintain any changes yourself.
11 // REDIS - Split out configuration into an array
12 if (env('REDIS_SERVERS', false)) {
13 $redisServerKeys = ['host', 'port', 'database'];
14 $redisServers = explode(',', trim(env('REDIS_SERVERS', '127.0.0.1:6379:0'), ','));
16 'cluster' => env('REDIS_CLUSTER', false)
18 foreach ($redisServers as $index => $redisServer) {
19 $redisServerName = ($index === 0) ? 'default' : 'redis-server-' . $index;
20 $redisServerDetails = explode(':', $redisServer);
21 if (count($redisServerDetails) < 2) $redisServerDetails[] = '6379';
22 if (count($redisServerDetails) < 3) $redisServerDetails[] = '0';
23 $redisConfig[$redisServerName] = array_combine($redisServerKeys, $redisServerDetails);
27 // MYSQL - Split out port from host if set
28 $mysql_host = env('DB_HOST', 'localhost');
29 $mysql_host_exploded = explode(':', $mysql_host);
30 $mysql_port = env('DB_PORT', 3306);
31 if (count($mysql_host_exploded) > 1) {
32 $mysql_host = $mysql_host_exploded[0];
33 $mysql_port = intval($mysql_host_exploded[1]);
38 // Default database connection name.
39 // Options: mysql, mysql_testing
40 'default' => env('DB_CONNECTION', 'mysql'),
42 // Available database connections
43 // Many of those shown here are unsupported by BookStack.
48 'database' => storage_path('database.sqlite'),
54 'host' => $mysql_host,
55 'database' => env('DB_DATABASE', 'forge'),
56 'username' => env('DB_USERNAME', 'forge'),
57 'password' => env('DB_PASSWORD', ''),
58 'unix_socket' => env('DB_SOCKET', ''),
59 'port' => $mysql_port,
60 'charset' => 'utf8mb4',
61 'collation' => 'utf8mb4_unicode_ci',
69 'host' => '127.0.0.1',
70 'database' => 'bookstack-test',
71 'username' => env('MYSQL_USER', 'bookstack-test'),
72 'password' => env('MYSQL_PASSWORD', 'bookstack-test'),
74 'collation' => 'utf8_unicode_ci',
81 'host' => env('DB_HOST', 'localhost'),
82 'database' => env('DB_DATABASE', 'forge'),
83 'username' => env('DB_USERNAME', 'forge'),
84 'password' => env('DB_PASSWORD', ''),
92 'host' => env('DB_HOST', 'localhost'),
93 'database' => env('DB_DATABASE', 'forge'),
94 'username' => env('DB_USERNAME', 'forge'),
95 'password' => env('DB_PASSWORD', ''),
102 // Migration Repository Table
103 // This table keeps track of all the migrations that have already run for
104 // your application. Using this information, we can determine which of
105 // the migrations on disk haven't actually been run in the database.
106 'migrations' => 'migrations',
108 // Redis configuration to use if set
109 'redis' => env('REDIS_SERVERS', false) ? $redisConfig : [],