]> BookStack Code Mirror - bookstack/blob - config/database.php
Fixed role permission removal bug
[bookstack] / config / database.php
1 <?php
2
3 // REDIS - Split out configuration into an array
4 if (env('REDIS_SERVERS', false)) {
5     $redisServerKeys = ['host', 'port', 'database'];
6     $redisServers = explode(',', trim(env('REDIS_SERVERS', '127.0.0.1:6379:0'), ','));
7     $redisConfig = [
8         'cluster' => env('REDIS_CLUSTER', false)
9     ];
10     foreach ($redisServers as $index => $redisServer) {
11         $redisServerName = ($index === 0) ? 'default' : 'redis-server-' . $index;
12         $redisServerDetails = explode(':', $redisServer);
13         if (count($redisServerDetails) < 2) $redisServerDetails[] = '6379';
14         if (count($redisServerDetails) < 3) $redisServerDetails[] = '0';
15         $redisConfig[$redisServerName] = array_combine($redisServerKeys, $redisServerDetails);
16     }
17 }
18
19 return [
20
21     /*
22     |--------------------------------------------------------------------------
23     | PDO Fetch Style
24     |--------------------------------------------------------------------------
25     |
26     | By default, database results will be returned as instances of the PHP
27     | stdClass object; however, you may desire to retrieve records in an
28     | array format for simplicity. Here you can tweak the fetch style.
29     |
30     */
31
32     'fetch' => PDO::FETCH_CLASS,
33
34     /*
35     |--------------------------------------------------------------------------
36     | Default Database Connection Name
37     |--------------------------------------------------------------------------
38     |
39     | Here you may specify which of the database connections below you wish
40     | to use as your default connection for all database work. Of course
41     | you may use many connections at once using the Database library.
42     |
43     */
44
45     'default' => env('DB_CONNECTION', 'mysql'),
46
47     /*
48     |--------------------------------------------------------------------------
49     | Database Connections
50     |--------------------------------------------------------------------------
51     |
52     | Here are each of the database connections setup for your application.
53     | Of course, examples of configuring each database platform that is
54     | supported by Laravel is shown below to make development simple.
55     |
56     |
57     | All database work in Laravel is done through the PHP PDO facilities
58     | so make sure you have the driver for your particular database of
59     | choice installed on your machine before you begin development.
60     |
61     */
62
63     'connections' => [
64
65         'sqlite' => [
66             'driver'   => 'sqlite',
67             'database' => storage_path('database.sqlite'),
68             'prefix'   => '',
69         ],
70
71         'mysql' => [
72             'driver'    => 'mysql',
73             'host'      => env('DB_HOST', 'localhost'),
74             'database'  => env('DB_DATABASE', 'forge'),
75             'username'  => env('DB_USERNAME', 'forge'),
76             'password'  => env('DB_PASSWORD', ''),
77             'charset'   => 'utf8',
78             'collation' => 'utf8_unicode_ci',
79             'prefix'    => '',
80             'strict'    => false,
81         ],
82
83         'mysql_testing' => [
84             'driver'    => 'mysql',
85             'host'      => '127.0.0.1',
86             'database'  => 'bookstack-test',
87             'username'  => env('MYSQL_USER', 'bookstack-test'),
88             'password'  => env('MYSQL_PASSWORD', 'bookstack-test'),
89             'charset'   => 'utf8',
90             'collation' => 'utf8_unicode_ci',
91             'prefix'    => '',
92             'strict'    => false,
93         ],
94
95         'pgsql' => [
96             'driver'   => 'pgsql',
97             'host'     => env('DB_HOST', 'localhost'),
98             'database' => env('DB_DATABASE', 'forge'),
99             'username' => env('DB_USERNAME', 'forge'),
100             'password' => env('DB_PASSWORD', ''),
101             'charset'  => 'utf8',
102             'prefix'   => '',
103             'schema'   => 'public',
104         ],
105
106         'sqlsrv' => [
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', ''),
112             'charset'  => 'utf8',
113             'prefix'   => '',
114         ],
115
116     ],
117
118     /*
119     |--------------------------------------------------------------------------
120     | Migration Repository Table
121     |--------------------------------------------------------------------------
122     |
123     | This table keeps track of all the migrations that have already run for
124     | your application. Using this information, we can determine which of
125     | the migrations on disk haven't actually been run in the database.
126     |
127     */
128
129     'migrations' => 'migrations',
130
131     /*
132     |--------------------------------------------------------------------------
133     | Redis Databases
134     |--------------------------------------------------------------------------
135     |
136     | Redis is an open source, fast, and advanced key-value store that also
137     | provides a richer set of commands than a typical key-value systems
138     | such as APC or Memcached. Laravel makes it easy to dig right in.
139     |
140     */
141
142     'redis' => env('REDIS_SERVERS', false) ? $redisConfig : [],
143
144 ];