I'm using sequelize migrations. Here is my config.js:
require('dotenv').config()
module.exports = {
development: {
database: process.env.DEV_DATABASE,
host: process.env.DEV_HOST,
dialect: 'postgres'
},
test: {
database: process.env.TEST_DATABASE,
host: process.env.TEST_HOST,
dialect: 'postgres'
},
production: {
database: process.env.DATABASE_URL,
dialect: 'postgres'
},
}
When I deploy to heroku and run:
heroku run npx sequelize-cli db:migrate
I get the error:
Loaded configuration file "config/config.js".
Using environment "production".
ERROR: connect ECONNREFUSED 127.0.0.1:5432
I have tried changing my config to use_env_variable: DATABASE_URL and I get Error reading "config/config.js". Error: ReferenceError: DATABASE_URL is not defined
If I console.log(process.env.DATABASE_URL) I get something like:
postgres://bczwqcbnwftivi:80bbc89546c0953e0ffd221a950cac249d25d4ef1812127054af7c2f504b2c39@ec2-54-225-205-79.compute-1.amazonaws.com:5432/d8gsvl0n8qilcs
