]> BookStack Code Mirror - bookstack/blob - config/database.php
Update Dutch password_hint translation to correspond with validation rule
[bookstack] / config / database.php
1 <?php
2
3 /**
4  * Database configuration options.
5  *
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.
9  */
10
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'), ','));
15     $redisConfig = [
16         'cluster' => env('REDIS_CLUSTER', false)
17     ];
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);
24     }
25 }
26
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]);
34 }
35
36 return [
37
38     // Default database connection name.
39     // Options: mysql, mysql_testing
40     'default' => env('DB_CONNECTION', 'mysql'),
41
42     // Available database connections
43     // Many of those shown here are unsupported by BookStack.
44     'connections' => [
45
46         'sqlite' => [
47             'driver'   => 'sqlite',
48             'database' => storage_path('database.sqlite'),
49             'prefix'   => '',
50         ],
51
52         'mysql' => [
53             'driver'    => 'mysql',
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',
62             'prefix'    => '',
63             'strict'    => false,
64             'engine' => null,
65         ],
66
67         'mysql_testing' => [
68             'driver'    => 'mysql',
69             'host'      => '127.0.0.1',
70             'database'  => 'bookstack-test',
71             'username'  => env('MYSQL_USER', 'bookstack-test'),
72             'password'  => env('MYSQL_PASSWORD', 'bookstack-test'),
73             'charset'   => 'utf8',
74             'collation' => 'utf8_unicode_ci',
75             'prefix'    => '',
76             'strict'    => false,
77         ],
78
79         'pgsql' => [
80             'driver'   => 'pgsql',
81             'host'     => env('DB_HOST', 'localhost'),
82             'database' => env('DB_DATABASE', 'forge'),
83             'username' => env('DB_USERNAME', 'forge'),
84             'password' => env('DB_PASSWORD', ''),
85             'charset'  => 'utf8',
86             'prefix'   => '',
87             'schema'   => 'public',
88         ],
89
90         'sqlsrv' => [
91             'driver'   => 'sqlsrv',
92             'host'     => env('DB_HOST', 'localhost'),
93             'database' => env('DB_DATABASE', 'forge'),
94             'username' => env('DB_USERNAME', 'forge'),
95             'password' => env('DB_PASSWORD', ''),
96             'charset'  => 'utf8',
97             'prefix'   => '',
98         ],
99
100     ],
101
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',
107
108     // Redis configuration to use if set
109     'redis' => env('REDIS_SERVERS', false) ? $redisConfig : [],
110
111 ];