title: Setting default environment variables in Heroku
body: <p>I'm working on an app that connects to third-party APIs which require the use of an APP ID and SECRET KEY.</p>
  
  <p>I am storing these values as environment variables in heroku, so that  I don't need to expose them in my code.</p>
  
  <p>If I deploy to heroku, it will use heroku's environment variables to resolve these API credentials.</p>
  
  <p>If I'm working on it locally, I want to use my <code>config.js</code> module, and lookup the API credentials there.  NOTE: This <code>config.js</code> file is included in my <code>.gitignore</code> so that these credentials never end up in the cloud.</p>
  
  <p>The problematic code is this:</p>
  
  <pre><code>var api_secret = process.env.API_SECRET || require('../../config.js').secret;
  </code></pre>
  
  <p>When I run this locally, I've got no issues. Meaning, it is unable to resolve the environment variable, so instead it uses the <code>secret</code> from within <code>config.js</code>.</p>
  
  <p>When I run it on heroku, it DOES throw an error telling me that <code>module 'config.js' could not be found</code>.  This makes sense, because it was never pushed up with the rest of the repo, by virtue that it is in my <code>.gitignore</code>.</p>
  
  <p>Because heroku is parsing through my code before it ever runs, the <code>require('../../config.js')</code> is problematic. It is trying to lookup a file that doesn't exist.</p>
  
  <p>How can I solve the issue of using environment variables when deployed, and the <code>config.js</code> module when running locally?</p>