2015-02-05 21:39:52 -06:00
|
|
|
<?php
|
2017-10-21 01:40:00 -05:00
|
|
|
/**
|
|
|
|
* database.php
|
2019-10-01 23:38:00 -05:00
|
|
|
* Copyright (c) 2019 thegrumpydictator@gmail.com
|
2017-10-21 01:40:00 -05:00
|
|
|
*
|
2019-10-01 23:38:00 -05:00
|
|
|
* This file is part of Firefly III (https://github.com/firefly-iii).
|
2017-10-21 01:40:00 -05:00
|
|
|
*
|
2019-10-01 23:38:00 -05: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 01:40:00 -05:00
|
|
|
*
|
2019-10-01 23:38:00 -05:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
2017-10-21 01:40:00 -05:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2019-10-01 23:38:00 -05:00
|
|
|
* GNU Affero General Public License for more details.
|
2017-10-21 01:40:00 -05:00
|
|
|
*
|
2019-10-01 23:38:00 -05: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 01:40:00 -05:00
|
|
|
*/
|
|
|
|
|
2019-12-07 23:28:00 -06:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2019-12-07 23:14:49 -06:00
|
|
|
use Illuminate\Support\Str;
|
|
|
|
|
2017-09-14 10:40:02 -05:00
|
|
|
|
2017-08-12 03:27:45 -05:00
|
|
|
|
2017-11-29 09:23:17 -06:00
|
|
|
$databaseUrl = getenv('DATABASE_URL');
|
|
|
|
$host = '';
|
|
|
|
$username = '';
|
|
|
|
$password = '';
|
|
|
|
$database = '';
|
2019-09-08 01:00:53 -05:00
|
|
|
$port = '';
|
2017-11-29 09:23:17 -06:00
|
|
|
|
2018-10-21 04:08:54 -05:00
|
|
|
if (!(false === $databaseUrl)) {
|
2019-09-07 13:44:02 -05:00
|
|
|
|
2017-11-29 09:26:00 -06:00
|
|
|
$options = parse_url($databaseUrl);
|
2019-09-07 13:44:02 -05: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 09:26:00 -06:00
|
|
|
}
|
2017-11-29 09:23:17 -06:00
|
|
|
|
2015-02-05 21:39:52 -06:00
|
|
|
return [
|
|
|
|
|
2018-04-26 23:26:37 -05:00
|
|
|
'default' => envNonEmpty('DB_CONNECTION', 'mysql'),
|
2015-02-07 03:32:15 -06:00
|
|
|
'connections' => [
|
|
|
|
'sqlite' => [
|
2016-11-19 08:55:49 -06:00
|
|
|
'driver' => 'sqlite',
|
2018-04-26 23:26:37 -05:00
|
|
|
'database' => envNonEmpty('DB_DATABASE', storage_path('database/database.sqlite')),
|
2016-11-19 08:55:49 -06:00
|
|
|
'prefix' => '',
|
2015-02-07 03:32:15 -06:00
|
|
|
],
|
2017-09-09 15:32:11 -05:00
|
|
|
'mysql' => [
|
|
|
|
'driver' => 'mysql',
|
2019-09-07 13:44:02 -05: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 15:32:11 -05:00
|
|
|
'unix_socket' => env('DB_SOCKET', ''),
|
|
|
|
'charset' => 'utf8mb4',
|
|
|
|
'collation' => 'utf8mb4_unicode_ci',
|
|
|
|
'prefix' => '',
|
|
|
|
'strict' => true,
|
2018-10-17 08:50:43 -05:00
|
|
|
'engine' => 'InnoDB',
|
2015-02-07 03:32:15 -06:00
|
|
|
],
|
2017-09-09 15:32:11 -05:00
|
|
|
'pgsql' => [
|
2019-03-02 07:33:46 -06:00
|
|
|
'driver' => 'pgsql',
|
|
|
|
'host' => envNonEmpty('DB_HOST', $host),
|
2019-09-07 13:44:02 -05:00
|
|
|
'port' => envNonEmpty('DB_PORT', $port),
|
2019-03-02 07:33:46 -06: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 03:32:15 -06:00
|
|
|
],
|
2017-09-09 15:32:11 -05: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 03:32:15 -06:00
|
|
|
|
|
|
|
],
|
2016-11-19 08:55:49 -06:00
|
|
|
'migrations' => 'migrations',
|
2019-12-07 23:14:49 -06: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 08:55:49 -06:00
|
|
|
'redis' => [
|
2019-12-07 23:14:49 -06: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 03:32:15 -06:00
|
|
|
'default' => [
|
2019-12-07 23:14:49 -06:00
|
|
|
'url' => env('REDIS_URL'),
|
2017-09-09 15:32:11 -05:00
|
|
|
'host' => env('REDIS_HOST', '127.0.0.1'),
|
2016-01-08 08:59:21 -06:00
|
|
|
'password' => env('REDIS_PASSWORD', null),
|
2016-11-19 08:55:49 -06:00
|
|
|
'port' => env('REDIS_PORT', 6379),
|
2019-12-07 10:44:33 -06:00
|
|
|
'database' => env('REDIS_DB', '0'),
|
2015-02-07 03:32:15 -06:00
|
|
|
],
|
2019-12-07 23:14:49 -06: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 03:32:15 -06:00
|
|
|
],
|
2017-09-09 15:32:11 -05:00
|
|
|
|
2015-02-05 21:39:52 -06:00
|
|
|
];
|