How to load environmental variables for Node propertly using dotenv?

154 views Asked by At

So I need to be able to load environmental variables based on if I'm on Heroku or localhost in my app. It looks like the way to do this is have an environmental variable called NODE_ENV, and set it to 'production' or 'dev' or whatever. However, to do that, I need to first detect if I'm on localhost, in which case I will grab variables using the dotenv module. So, it's kind of a recursive problem...is there a standard way to go about this?

0

There are 0 answers