title: Heroku NODE_ENV environment variable
body: <p>I'm running a Node project with Heroku as my main deploy target. In dev environment I'm using grunt to start the web server, however in production I prefer to launch the app directly with <code>node app</code></p>
  
  <p>Here's my Procfile:</p>
  
  <pre><code>web: bin/web
  </code></pre>
  
  <p>And bin/web:</p>
  
  <pre><code>#!/bin/sh                                                                       
  echo "NODE_ENV=" $NODE_ENV
  if [ "$NODE_ENV" == "production" ]; then
      echo "Starting the server with node app"
      node app
  else
      echo "Starting the server using grunt"
      grunt
  fi
  </code></pre>
  
  <p>The first <code>echo</code> is for debugging. heroku log is showing:</p>
  
  <pre><code>app[web.1]: NODE_ENV=
  </code></pre>
  
  <p>Basically, meaning NODE_ENV is not set. (and the app starts with grunt instead of <code>node app</code>)</p>
  
  <p>The <a href="https://devcenter.heroku.com/articles/nodejs-support">docs</a> say that "The NODE_ENV environment variable defaults to production, but you can override it if you wish"</p>
  
  <p>What am I missing?</p>