Alexander Kleinhans
Alexander Kleinhans

Reputation: 6258

Can't seem to set a local java envar DATABASE url for local heroku app

I really tried here, but I'm a bit new to postgrs and java and heroku. I've got my live instance doing fine. I've setup a local database by exporting the old dump file and pg_restoring here. I just can't seem to set the DATABASE_URL local envar. I was looking through the JavaDB source and it's definitely enVar on line 36.

I though this would be in .bash_profile or .bash_rc. I'm on a mac. I tried exporting it per export DATABASE_URL=postgres://foo:foo@localhost/hellodb (With my actual names). Then sourced both profiles again. I rebuilt with maven clean install. Re-ran the server locally. Double checked the psql file, created a user and a password but it's not even getting to that step because it can't fine the var. Do I need to put it in .env file or something?

Thanks for the help.

EDIT:

I couldn't tag envar since I didn't have enough points (lame!)

EDIT (Connected, but unusual):

The solution was to put the var in the .env file and put it in the gitignore, then rebuild etc.

I now have the error: Something unusual has occurred to cause the driver to fail. Please report this exception.

Upvotes: 0

Views: 114

Answers (1)

Alexander Kleinhans
Alexander Kleinhans

Reputation: 6258

Was necessary to put variables in .env file, not only export them. DATABASE_URL=postgres://username:password@localhost:port/database and port was 5432.

I also built, restarted, and ensured .env was ignored.

Upvotes: 1

Related Questions