Skip to content

Firefly III: a personal finances manager

Update config for Heroku [skip ci]

James Colededf774bf2f1
diff --git a/.env.heroku b/.env.heroku
index 44ed7bfaaa..66cf476555 100644
--- a/.env.heroku
+++ b/.env.heroku
@@ -8,11 +8,8 @@ APP_URL=http://localhost
TRUSTED_PROXIES=
DB_CONNECTION=pgsql
-DB_HOST=127.0.0.1
-DB_PORT=3306
-DB_DATABASE=homestead
-DB_USERNAME=homestead
-DB_PASSWORD=secret
+# no DB info, is in database URL.
+
BROADCAST_DRIVER=log
CACHE_DRIVER=file
diff --git a/app.json b/app.json
index 98fd5d30a7..ceeddf8d98 100644
--- a/app.json
+++ b/app.json
@@ -43,7 +43,7 @@
}
],
"scripts": {
- "postdeploy": "php artisan migrate:refresh --seed"
+ "postdeploy": "php artisan migrate:refresh --seed;php artisan firefly:instructions install"
},
"buildpacks": [
{
diff --git a/config/database.php b/config/database.php
index f23918048e..16376413de 100644
--- a/config/database.php
+++ b/config/database.php
@@ -22,6 +22,20 @@
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 [
'default' => env('DB_CONNECTION', 'mysql'),
@@ -47,11 +61,11 @@ return [
],
'pgsql' => [
'driver' => 'pgsql',
- 'host' => env('DB_HOST', '127.0.0.1'),
+ 'host' => env('DB_HOST', $host),
'port' => env('DB_PORT', '5432'),
- 'database' => env('DB_DATABASE', 'forge'),
- 'username' => env('DB_USERNAME', 'forge'),
- 'password' => env('DB_PASSWORD', ''),
+ 'database' => env('DB_DATABASE', $database),
+ 'username' => env('DB_USERNAME', $username),
+ 'password' => env('DB_PASSWORD', $password),
'charset' => 'utf8',
'prefix' => '',
'schema' => 'public',