Differentiating production environment in javascript file alone
<p>The main idea is to have the same codebase running on different environments off VCS (GIT), and make code aware of its environment outside of what's committed inside the repository, like setting an environment variable or detecting the location or name of config file.</p>

<p>We have several options differentiating different environment at the code level but how to go about it doing in a JavaScript file which is running in the browser?</p>

<p>1) If I had the page being generated dynamically, I could probably set the value in a global variable <code>app.whereami = 'production'</code> and then pick that up in JavaScript code.</p>

<p>2) I can check for the domain on which the code is running. If this then production, if that, consider it staging, anything else is local. This would work but is restrictive in terms of url, and really not the best way out.</p>

<p>What other options do I have?</p>
