Update config for Heroku [skip ci]

This commit is contained in:
James Cole 2017-11-29 16:23:17 +01:00
parent 18a5bb682d
commit dedf774bf2
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
3 changed files with 21 additions and 10 deletions

View File

@ -8,11 +8,8 @@ APP_URL=http://localhost
TRUSTED_PROXIES= TRUSTED_PROXIES=
DB_CONNECTION=pgsql DB_CONNECTION=pgsql
DB_HOST=127.0.0.1 # no DB info, is in database URL.
DB_PORT=3306
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
BROADCAST_DRIVER=log BROADCAST_DRIVER=log
CACHE_DRIVER=file CACHE_DRIVER=file

View File

@ -43,7 +43,7 @@
} }
], ],
"scripts": { "scripts": {
"postdeploy": "php artisan migrate:refresh --seed" "postdeploy": "php artisan migrate:refresh --seed;php artisan firefly:instructions install"
}, },
"buildpacks": [ "buildpacks": [
{ {

View File

@ -22,6 +22,20 @@
declare(strict_types=1); declare(strict_types=1);
$databaseUrl = getenv('DATABASE_URL');
$host = '';
$username = '';
$password = '';
$database = '';
+if (!($databaseUrl === false)) {
$options = parse_url($databaseUrl);
$host = $options['host'];
$username = $options['user'];
$password = $options['pass'];
$database = substr($options['path'], 1);
}
return [ return [
'default' => env('DB_CONNECTION', 'mysql'), 'default' => env('DB_CONNECTION', 'mysql'),
@ -47,11 +61,11 @@ return [
], ],
'pgsql' => [ 'pgsql' => [
'driver' => 'pgsql', 'driver' => 'pgsql',
'host' => env('DB_HOST', '127.0.0.1'), 'host' => env('DB_HOST', $host),
'port' => env('DB_PORT', '5432'), 'port' => env('DB_PORT', '5432'),
'database' => env('DB_DATABASE', 'forge'), 'database' => env('DB_DATABASE', $database),
'username' => env('DB_USERNAME', 'forge'), 'username' => env('DB_USERNAME', $username),
'password' => env('DB_PASSWORD', ''), 'password' => env('DB_PASSWORD', $password),
'charset' => 'utf8', 'charset' => 'utf8',
'prefix' => '', 'prefix' => '',
'schema' => 'public', 'schema' => 'public',