I am working on a corona virus project based on nodejs and postgresql. I'm trying to deploy my app on heroku but i encounter some issues. Those issues comes from the the postgres configuration (i think).
I have a .env file where i've initialise some variables (DATABASE_URL,...) and i don't know how to transmit them to heroku. I've associate an addon postgres-heroku and it generate a DATABASE_URL variable with a random value. And i want now, to set this value to my real DATABASE_URL in the .env file.
the commandes ----> "heroku config:set DATABASE_URL= ****" gives an issues...
The .env file
# DATABASE PARAMETERS
DATABASE_NAME = *****
DATABASE_USER = postgres
DATABASE_PASSWORD = ********
DATABASE_PORT = 5432
DATABASE_HOST = localhost
DATABASE_DIALECT = postgres
DATABASE_HOST_PROD= 172.17.0.1
export DATABASE_URL= postgres://postgres:*******@localhost:5432/*****
The database.yml file
# For dev
development:
# For prod
production:
adapter: postgresql
encoding: unicode
database: ENV['DATABASE_NAME']
pool: 5
username: ENV['DATABASE_USER']
url: ENV['DATABASE_URL']
password: ENV['DATABASE_PASSWORD']
host: ENV['DATABASE_HOST']
The architecture:
>config
>models
>node_modules
>routes
>services
.env
app.js
database.yml
package_lock.json
package.json
Procfile
Don't hesitate to ask for some code if needed. I really really really, need your help guys...
Thank you
You need to break down DATABASE_URL so that you can add the variables you used for local.The format is like this
database_driver:/username:password@host:port/database_name
Yyou cannot alter DATABASE_URL on heroku.