Skip to content

Instantly share code, notes, and snippets.

@Sitebase
Created February 12, 2015 22:30
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Sitebase/9e2ac2d3f0034382addf to your computer and use it in GitHub Desktop.
Save Sitebase/9e2ac2d3f0034382addf to your computer and use it in GitHub Desktop.
Detect if node app is running on Heroku
function isHeroku()
{
return process.env.NODE && ~process.env.NODE.indexOf("heroku") ? true : false;
}
@Lancelot-RMT
Copy link

Lancelot-RMT commented Jan 17, 2018

For your information, this is not working.
This solution however worked for me.

@Alvai
Copy link

Alvai commented Aug 2, 2018

Thanks for the gist, it's working but i changed it a little bit to work really properly process.env.NODE.indexOf('heroku') !== -1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment