How to run sequelize db:migrate on Elastic Beanstalk EB with env vars? How to access .env vars in container commands?

前端 未结 3 1496
梦如初夏
梦如初夏 2021-01-22 04:56

How can I run sequelize db:migrate on ElasticBeanstalk with env vars?

Running sequelize migrate fails since it cannot find the .env file.<

3条回答
  •  遥遥无期
    2021-01-22 05:26

    Edit:

    I just found out what's going on with environment variables. Try running the migration script without npm. It'll be something like:

    ./node_modules/.bin/sequelize db:migrate

    This way, you'll get all the environment variables as you expect.

    Old answer:

    Are you sure your .env file is committed to your git repo? In general, it's not a good idea to commit a .env to git and use it in production. You should instead set environment variables in your Elastic Beanstalk dashboard under Software Configuration.

    You could also use the eb command line utility as documented here.

提交回复
热议问题