. */ declare(strict_types=1); $databaseUrl = getenv('DATABASE_URL'); $host = ''; $username = ''; $password = ''; $database = ''; if (!(false === $databaseUrl)) { $options = parse_url($databaseUrl); $host = $options['host']; $username = $options['user']; $password = $options['pass']; $database = substr($options['path'], 1); } return [ 'default' => envNonEmpty('DB_CONNECTION', 'mysql'), 'connections' => [ 'sqlite' => [ 'driver' => 'sqlite', 'database' => envNonEmpty('DB_DATABASE', storage_path('database/database.sqlite')), 'prefix' => '', ], 'mysql' => [ 'driver' => 'mysql', 'host' => envNonEmpty('DB_HOST', '127.0.0.1'), 'port' => envNonEmpty('DB_PORT', '3306'), 'database' => envNonEmpty('DB_DATABASE', 'forge'), 'username' => envNonEmpty('DB_USERNAME', 'forge'), 'password' => env('DB_PASSWORD', ''), 'unix_socket' => env('DB_SOCKET', ''), 'charset' => 'utf8mb4', 'collation' => 'utf8mb4_unicode_ci', 'prefix' => '', 'strict' => true, 'engine' => 'InnoDB', ], 'pgsql' => [ 'driver' => 'pgsql', 'host' => envNonEmpty('DB_HOST', $host), 'port' => envNonEmpty('DB_PORT', '5432'), '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'), ], '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' => '', ], ], 'migrations' => 'migrations', 'redis' => [ 'client' => 'predis', 'default' => [ 'host' => env('REDIS_HOST', '127.0.0.1'), 'password' => env('REDIS_PASSWORD', null), 'port' => env('REDIS_PORT', 6379), 'database' => 0, ], ], ];