Skip to content

Instantly share code, notes, and snippets.

@mbleigh
Created September 9, 2016 17:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbleigh/da9abda27104810b790b1ea4e8208582 to your computer and use it in GitHub Desktop.
Save mbleigh/da9abda27104810b790b1ea4e8208582 to your computer and use it in GitHub Desktop.
var ENVS = {
prod: {firebase: {firebaseURL: 'https://my-app-prod.firebaseio.com'}},
staging: {firebase: {firebaseURL: 'https://my-app-staging.firebaseio.com'}},
dev: {firebase: {firebaseURL: 'https://my-app-dev.firebaseio.com'}},
}
window.__env = (function() {
switch(window.location.hostname) {
case 'localhost':
return ENVS.dev;
case 'my-app-staging.firebaseapp.com':
case 'my-app-staging.com':
return ENVS.staging;
case 'my-app-prod.firebaseapp.com':
case 'my-app.com':
return ENVS.prod;
}
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment