Search code examples
node.jsmongodbherokudotenv

How can I set environment variables in a Heroku app


So I'm currently working on a side project that requires a database. I choose to opt for MongoDB. I have the dotenv package installed so I can use this to save my secret mongoDB connection string.

I'd like to deploy my application to Heroku, but of course I don't want to push my .env to a github repo for this. Is there any way around this? It is a heroku-git repo but I have no idea how secure this would be. Anyone any other ideas on how to still keep the connection string secret and push the app to a platform like Heroku?


Solution

  • In the Settings tab of your app, the option is present