| 
									
										
										
										
											2015-02-06 04:39:52 +01:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2017-10-21 08:40:00 +02:00
										 |  |  | /** | 
					
						
							|  |  |  |  * database.php | 
					
						
							| 
									
										
										
										
											2019-10-02 06:38:00 +02:00
										 |  |  |  * Copyright (c) 2019 thegrumpydictator@gmail.com | 
					
						
							| 
									
										
										
										
											2017-10-21 08:40:00 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-10-02 06:38:00 +02:00
										 |  |  |  * This file is part of Firefly III (https://github.com/firefly-iii). | 
					
						
							| 
									
										
										
										
											2017-10-21 08:40:00 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-10-02 06:38:00 +02:00
										 |  |  |  * This program is free software: you can redistribute it and/or modify | 
					
						
							|  |  |  |  * it under the terms of the GNU Affero General Public License as | 
					
						
							|  |  |  |  * published by the Free Software Foundation, either version 3 of the | 
					
						
							|  |  |  |  * License, or (at your option) any later version. | 
					
						
							| 
									
										
										
										
											2017-10-21 08:40:00 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-10-02 06:38:00 +02:00
										 |  |  |  * This program is distributed in the hope that it will be useful, | 
					
						
							| 
									
										
										
										
											2017-10-21 08:40:00 +02:00
										 |  |  |  * but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							| 
									
										
										
										
											2019-10-02 06:38:00 +02:00
										 |  |  |  * GNU Affero General Public License for more details. | 
					
						
							| 
									
										
										
										
											2017-10-21 08:40:00 +02:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2019-10-02 06:38:00 +02:00
										 |  |  |  * You should have received a copy of the GNU Affero General Public License | 
					
						
							|  |  |  |  * along with this program.  If not, see <https://www.gnu.org/licenses/>. | 
					
						
							| 
									
										
										
										
											2017-10-21 08:40:00 +02:00
										 |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-08 06:28:00 +01:00
										 |  |  | declare(strict_types=1); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-12-08 06:14:49 +01:00
										 |  |  | use Illuminate\Support\Str; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-14 17:40:02 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-08-12 10:27:45 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-29 16:23:17 +01:00
										 |  |  | $databaseUrl = getenv('DATABASE_URL'); | 
					
						
							|  |  |  | $host        = ''; | 
					
						
							|  |  |  | $username    = ''; | 
					
						
							|  |  |  | $password    = ''; | 
					
						
							|  |  |  | $database    = ''; | 
					
						
							| 
									
										
										
										
											2019-09-08 08:00:53 +02:00
										 |  |  | $port        = ''; | 
					
						
							| 
									
										
										
										
											2017-11-29 16:23:17 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-10-21 11:08:54 +02:00
										 |  |  | if (!(false === $databaseUrl)) { | 
					
						
							| 
									
										
										
										
											2019-09-07 20:44:02 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-11-29 16:26:00 +01:00
										 |  |  |     $options  = parse_url($databaseUrl); | 
					
						
							| 
									
										
										
										
											2019-09-07 20:44:02 +02:00
										 |  |  |     $host     = $options['host'] ?? 'firefly_iii_db'; | 
					
						
							|  |  |  |     $username = $options['user'] ?? 'firefly'; | 
					
						
							|  |  |  |     $port     = $options['port'] ?? '5432'; | 
					
						
							|  |  |  |     $password = $options['pass'] ?? 'secret_firefly_password'; | 
					
						
							|  |  |  |     $database = substr($options['path'] ?? '/firefly', 1); | 
					
						
							| 
									
										
										
										
											2017-11-29 16:26:00 +01:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2017-11-29 16:23:17 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-06 04:39:52 +01:00
										 |  |  | return [ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-04-27 06:26:37 +02:00
										 |  |  |     'default'     => envNonEmpty('DB_CONNECTION', 'mysql'), | 
					
						
							| 
									
										
										
										
											2015-02-07 10:32:15 +01:00
										 |  |  |     'connections' => [ | 
					
						
							|  |  |  |         'sqlite' => [ | 
					
						
							| 
									
										
										
										
											2016-11-19 15:55:49 +01:00
										 |  |  |             'driver'   => 'sqlite', | 
					
						
							| 
									
										
										
										
											2018-04-27 06:26:37 +02:00
										 |  |  |             'database' => envNonEmpty('DB_DATABASE', storage_path('database/database.sqlite')), | 
					
						
							| 
									
										
										
										
											2016-11-19 15:55:49 +01:00
										 |  |  |             'prefix'   => '', | 
					
						
							| 
									
										
										
										
											2015-02-07 10:32:15 +01:00
										 |  |  |         ], | 
					
						
							| 
									
										
										
										
											2017-09-09 22:32:11 +02:00
										 |  |  |         'mysql'  => [ | 
					
						
							|  |  |  |             'driver'      => 'mysql', | 
					
						
							| 
									
										
										
										
											2019-09-07 20:44:02 +02:00
										 |  |  |             'host'        => envNonEmpty('DB_HOST', $host), | 
					
						
							|  |  |  |             'port'        => envNonEmpty('DB_PORT', $port), | 
					
						
							|  |  |  |             'database'    => envNonEmpty('DB_DATABASE', $database), | 
					
						
							|  |  |  |             'username'    => envNonEmpty('DB_USERNAME', $username), | 
					
						
							|  |  |  |             'password'    => env('DB_PASSWORD', $password), | 
					
						
							| 
									
										
										
										
											2017-09-09 22:32:11 +02:00
										 |  |  |             'unix_socket' => env('DB_SOCKET', ''), | 
					
						
							|  |  |  |             'charset'     => 'utf8mb4', | 
					
						
							|  |  |  |             'collation'   => 'utf8mb4_unicode_ci', | 
					
						
							|  |  |  |             'prefix'      => '', | 
					
						
							|  |  |  |             'strict'      => true, | 
					
						
							| 
									
										
										
										
											2018-10-17 15:50:43 +02:00
										 |  |  |             'engine'      => 'InnoDB', | 
					
						
							| 
									
										
										
										
											2015-02-07 10:32:15 +01:00
										 |  |  |         ], | 
					
						
							| 
									
										
										
										
											2017-09-09 22:32:11 +02:00
										 |  |  |         'pgsql'  => [ | 
					
						
							| 
									
										
										
										
											2019-03-02 14:33:46 +01:00
										 |  |  |             'driver'      => 'pgsql', | 
					
						
							|  |  |  |             'host'        => envNonEmpty('DB_HOST', $host), | 
					
						
							| 
									
										
										
										
											2019-09-07 20:44:02 +02:00
										 |  |  |             'port'        => envNonEmpty('DB_PORT', $port), | 
					
						
							| 
									
										
										
										
											2019-03-02 14:33:46 +01:00
										 |  |  |             'database'    => envNonEmpty('DB_DATABASE', $database), | 
					
						
							|  |  |  |             'username'    => envNonEmpty('DB_USERNAME', $username), | 
					
						
							|  |  |  |             'password'    => env('DB_PASSWORD', $password), | 
					
						
							|  |  |  |             'charset'     => 'utf8', | 
					
						
							|  |  |  |             'prefix'      => '', | 
					
						
							|  |  |  |             'schema'      => 'public', | 
					
						
							|  |  |  |             'sslmode'     => envNonEmpty('PGSQL_SSL_MODE', 'prefer'), | 
					
						
							|  |  |  |             'sslcert'     => envNonEmpty('PGSQL_SSL_CERT'), | 
					
						
							|  |  |  |             'sslkey'      => envNonEmpty('PGSQL_SSL_KEY'), | 
					
						
							|  |  |  |             'sslrootcert' => envNonEmpty('PGSQL_SSL_ROOT_CERT'), | 
					
						
							| 
									
										
										
										
											2015-02-07 10:32:15 +01:00
										 |  |  |         ], | 
					
						
							| 
									
										
										
										
											2017-09-09 22:32:11 +02:00
										 |  |  |         'sqlsrv' => [ | 
					
						
							|  |  |  |             'driver'   => 'sqlsrv', | 
					
						
							|  |  |  |             'host'     => env('DB_HOST', 'localhost'), | 
					
						
							|  |  |  |             'port'     => env('DB_PORT', '1433'), | 
					
						
							|  |  |  |             'database' => env('DB_DATABASE', 'forge'), | 
					
						
							|  |  |  |             'username' => env('DB_USERNAME', 'forge'), | 
					
						
							|  |  |  |             'password' => env('DB_PASSWORD', ''), | 
					
						
							|  |  |  |             'charset'  => 'utf8', | 
					
						
							|  |  |  |             'prefix'   => '', | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2015-02-07 10:32:15 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  |     ], | 
					
						
							| 
									
										
										
										
											2016-11-19 15:55:49 +01:00
										 |  |  |     'migrations'  => 'migrations', | 
					
						
							| 
									
										
										
										
											2019-12-08 06:14:49 +01:00
										 |  |  |     /* | 
					
						
							|  |  |  |     |-------------------------------------------------------------------------- | 
					
						
							|  |  |  |     | Redis Databases | 
					
						
							|  |  |  |     |-------------------------------------------------------------------------- | 
					
						
							|  |  |  |     | | 
					
						
							|  |  |  |     | Redis is an open source, fast, and advanced key-value store that also | 
					
						
							|  |  |  |     | provides a richer body of commands than a typical key-value system | 
					
						
							|  |  |  |     | such as APC or Memcached. Laravel makes it easy to dig right in. | 
					
						
							|  |  |  |     | | 
					
						
							|  |  |  |     */ | 
					
						
							| 
									
										
										
										
											2016-11-19 15:55:49 +01:00
										 |  |  |     'redis'       => [ | 
					
						
							| 
									
										
										
										
											2019-12-08 06:14:49 +01:00
										 |  |  |         'client'  => env('REDIS_CLIENT', 'predis'), | 
					
						
							|  |  |  |         'options' => [ | 
					
						
							|  |  |  |             'cluster' => env('REDIS_CLUSTER', 'predis'), | 
					
						
							|  |  |  |             'prefix'  => env('REDIS_PREFIX', Str::slug(env('APP_NAME', 'laravel'), '_') . '_database_'), | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2015-02-07 10:32:15 +01:00
										 |  |  |         'default' => [ | 
					
						
							| 
									
										
										
										
											2019-12-08 06:14:49 +01:00
										 |  |  |             'url'      => env('REDIS_URL'), | 
					
						
							| 
									
										
										
										
											2017-09-09 22:32:11 +02:00
										 |  |  |             'host'     => env('REDIS_HOST', '127.0.0.1'), | 
					
						
							| 
									
										
										
										
											2016-01-08 15:59:21 +01:00
										 |  |  |             'password' => env('REDIS_PASSWORD', null), | 
					
						
							| 
									
										
										
										
											2016-11-19 15:55:49 +01:00
										 |  |  |             'port'     => env('REDIS_PORT', 6379), | 
					
						
							| 
									
										
										
										
											2019-12-07 17:44:33 +01:00
										 |  |  |             'database' => env('REDIS_DB', '0'), | 
					
						
							| 
									
										
										
										
											2015-02-07 10:32:15 +01:00
										 |  |  |         ], | 
					
						
							| 
									
										
										
										
											2019-12-08 06:14:49 +01:00
										 |  |  |         'cache'   => [ | 
					
						
							|  |  |  |             'url'      => env('REDIS_URL'), | 
					
						
							|  |  |  |             'host'     => env('REDIS_HOST', '127.0.0.1'), | 
					
						
							|  |  |  |             'password' => env('REDIS_PASSWORD', null), | 
					
						
							|  |  |  |             'port'     => env('REDIS_PORT', 6379), | 
					
						
							|  |  |  |             'database' => env('REDIS_CACHE_DB', '1'), | 
					
						
							|  |  |  |         ], | 
					
						
							| 
									
										
										
										
											2015-02-07 10:32:15 +01:00
										 |  |  |     ], | 
					
						
							| 
									
										
										
										
											2017-09-09 22:32:11 +02:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-02-06 04:39:52 +01:00
										 |  |  | ]; |