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