I currently use supervisor to run my node.js app when developing locally. This has been great, but I currently store all my configs in my .bash_profile
, I want to move them to a .env
file.
Is there a way to get the environment loading features of foreman with the file watching features of supervisor?
One option is to add it to my Procfile
like this, but I suspect that will mess up Heroku.
`local: supervisor web.js`
This is the solution I put together and it works great.
sudo gem install rerun rb-fsevent
sudo gem install foreman
.env
in the root of your project.Don't forget to add .env
to your .gitignore
, don't want that sensitive info in your code
echo '.env' >> .gitignore
Procfile
looks likeweb: node web.js
rerun foreman start web
echo "alias rrun='rerun foreman start web'" >> ~/.bash_profile
Another solution is to create another Procfile file for your development environment with your current configuration:
# Procfile.dev
web: supervisor app.js
And start foreman
using that file
$ foreman start -f Procfile.dev
You can optionally exclude that file from your git repo
$ echo "Procfile.dev" >> .git/info/exclude
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With