How do i deploy a mongo blog to heroku without revealing my database URI

I have the URI in .env and .gitignore. how do i get the database to connect and keep the URI a secret?

Does your .gitignore include your .env? That is for your local dev, and shouldn’t be part of your git anyway, right?

Found couple quick articles (on these very forums, interestingly enough) about this. First is about using .env for sensitive info (and how NOT to send it to github or heroku) and the second about setting up a mongodb for your heroku. Both seem to work hand-in-hand, I think.

heroku config:set 

this might do it



oooo nice find. Best of luck, let us know how it works out (so others who find this thread will find a good resolution).

idea generator

got it working. i found that solution on one of your links. heroku if full of super handy stuff

1 Like