Skip to content

Instantly share code, notes, and snippets.

@possibilities
Created June 7, 2012 18:01
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 possibilities/2890457 to your computer and use it in GitHub Desktop.
Save possibilities/2890457 to your computer and use it in GitHub Desktop.
new Demo({
hosts: {
production: ['forms.meteor.com']
},
github: {
user: 'possibilities',
repo: 'meteor-forms'
}
});
Demo.prototype._establishEnv = function() {
Meteor.env || (Meteor.env = {});
if (Meteor.is_client) {
if (this.hosts && this.hosts.production) {
var isProductionHost = _.contains(this.hosts.production, window.location.hostname);
Meteor.env.is_development = !isProductionHost;
Meteor.env.is_production = isProductionHost;
} else {
return console.log("You have to provide a list of production hosts for this to work on the client!");
}
} else {
var path = __meteor_bootstrap__.require('path');
var pathToConfig = process.env.HOME + '/.meteor.cfg';
var configExists = path.existsSync(pathToConfig);
Meteor.env.is_development = configExists;
Meteor.env.is_production = !configExists;
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment