I use Ruby (not Rails) and mount a PostgreSQL database. I'm trying to configure on Heroku, but I am having problems running the application. Running the application locally works fine.
My local .env looks like this:
postgres:
And connecting to Ruby to connect to the database is as follows:
@@db = PGconn.open(:hostaddr => ENV['DATABASE_URL'], :dbname => '(dbname)', :password => '(password)')
When I click on Heroku, the application crashes to this line and writes this error to the logs:
could not translate host name "postgres://(my heroku db address)" to address: Name or service not known (PG::Error)
The database address matches DATABASE_URL in my heroku:config . I use a shared database.
I tried using :host => ENV['DATABASE_URL'] (as opposed to :hostaddr ), but had the same result. I assume that there is something simple, but I did not have good ideas.
Alex ghiculescu
source share