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.
12 // Split out configuration into an array
13 if (env('REDIS_SERVERS', false)) {
15 $redisDefaults = ['host' => '127.0.0.1', 'port' => '6379', 'database' => '0', 'password' => null];
16 $redisServers = explode(',', trim(env('REDIS_SERVERS', '127.0.0.1:6379:0'), ','));
18 $cluster = count($redisServers) > 1;
21 $redisConfig['clusters'] = ['default' => []];
24 foreach ($redisServers as $index => $redisServer) {
25 $redisServerDetails = explode(':', $redisServer);
29 foreach ($redisDefaults as $configKey => $configDefault) {
30 $serverConfig[$configKey] = ($redisServerDetails[$configIndex] ?? $configDefault);
35 $redisConfig['clusters']['default'][] = $serverConfig;
37 $redisConfig['default'] = $serverConfig;
43 // Split out port from host if set
44 $mysql_host = env('DB_HOST', 'localhost');
45 $mysql_host_exploded = explode(':', $mysql_host);
46 $mysql_port = env('DB_PORT', 3306);
47 if (count($mysql_host_exploded) > 1) {
48 $mysql_host = $mysql_host_exploded[0];
49 $mysql_port = intval($mysql_host_exploded[1]);
54 // Default database connection name.
55 // Options: mysql, mysql_testing
56 'default' => env('DB_CONNECTION', 'mysql'),
58 // Available database connections
59 // Many of those shown here are unsupported by BookStack.
64 'database' => storage_path('database.sqlite'),
70 'host' => $mysql_host,
71 'database' => env('DB_DATABASE', 'forge'),
72 'username' => env('DB_USERNAME', 'forge'),
73 'password' => env('DB_PASSWORD', ''),
74 'unix_socket' => env('DB_SOCKET', ''),
75 'port' => $mysql_port,
76 'charset' => 'utf8mb4',
77 'collation' => 'utf8mb4_unicode_ci',
85 'host' => '127.0.0.1',
86 'database' => 'bookstack-test',
87 'username' => env('MYSQL_USER', 'bookstack-test'),
88 'password' => env('MYSQL_PASSWORD', 'bookstack-test'),
90 'collation' => 'utf8_unicode_ci',
97 'host' => env('DB_HOST', 'localhost'),
98 'database' => env('DB_DATABASE', 'forge'),
99 'username' => env('DB_USERNAME', 'forge'),
100 'password' => env('DB_PASSWORD', ''),
103 'schema' => 'public',
107 'driver' => 'sqlsrv',
108 'host' => env('DB_HOST', 'localhost'),
109 'database' => env('DB_DATABASE', 'forge'),
110 'username' => env('DB_USERNAME', 'forge'),
111 'password' => env('DB_PASSWORD', ''),
118 // Migration Repository Table
119 // This table keeps track of all the migrations that have already run for
120 // your application. Using this information, we can determine which of
121 // the migrations on disk haven't actually been run in the database.
122 'migrations' => 'migrations',
124 // Redis configuration to use if set
125 'redis' => env('REDIS_SERVERS', false) ? $redisConfig : [],