高级环境配置
对于更复杂的应用程序,你需要使用多个环境变量构建``settings.json`对象。
if(Meteor.isServer){
Meteor.startup(function()){
// this needs to be run on the server
var environment, settings;
environment = process.env.METEOR_ENV || "development";
settings = {
development: {
public: {
package: {
name: "jquery-datatables",
description: "Sort, page, and filter millions of records. Reactively.",
owner: "LumaPictures",
repo: "meteor-jquery-datatables"
}
},
private: {}
},
staging: {
public: {},
private: {}
},
production: {
public: {},
private: {}
}
};
if (!process.env.METEOR_SETTINGS) {
console.log("No METEOR_SETTINGS passed in, using locally defined settings.");
if (environment === "production") {
Meteor.settings = settings.production;
} else if (environment === "staging") {
Meteor.settings = settings.staging;
} else {
Meteor.settings = settings.development;
}
console.log("Using [ " + environment + " ] Meteor.settings");
}
});
}