Support the ongoing development of Laravel.io →
Configuration Database
Last updated 2 years ago.
0

Hi,

Not sure if you managed to get your original issue working, but the problem is how the app is configured to work with Heroku.

As you know, Heroku uses its own config vars to deliver the database details which sort of makes the 'dot' ENV file method obsolete, or at least annoying if you are using it because you have two places to store ENV vars.

This is fine when your actual app is interacting with the database, as the server vars have been parsed and initialised correctly, but fails when Artisan is run because it can't get the 'host' variable, as defined in the 'config/database.php' file, because the 'DATABASE_URL' ENV var has not been set.

My awful (and temporary) solution to this, was to update Artisan with a hardcoded 'DATABASE_URL' at the top of the file

putenv("DATABASE_URL=...);

This worked, and stopped the error, but it's obviously not the right solution. I'd be interested to hear if you or anyone else has the right solution, as i have no idea how to give Artisan the right details without using the 'dot' ENV file method


Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

taufnrsyd taufnrsyd Joined 6 Mar 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.