Skip to content

Instantly share code, notes, and snippets.

@mbleigh

mbleigh/env.js

Created Sep 9, 2016
Embed
What would you like to do?
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
You can’t perform that action at this time.