Tutorial by Examples

For more complex applications, you'll want to build up a ``settings.json` object using multiple environment variables. if(Meteor.isServer){ Meteor.startup(function()){ // this needs to be run on the server var environment, settings; environment = process.env.METEOR_ENV || "...
The METEOR_SETTINGS environment variable can accept JSON objects, and will expose that object in the Meteor.settings object. First, add a settings.json to your app root with some configuration info. { "public":{ "ga":{ "account":"UA-XXXXXXX-1" ...
Environment variables are also available to the server via the process.env object. if (Meteor.isServer) { Meteor.startup(function () { // detect environment by getting the root url of the application console.log(JSON.stringify(process.env.ROOT_URL)); // or by getting the port ...
To detect the environment on the server, we have to create a helper method on the server, as the server will determine which environment it is in, and then call the helper method from the client. Basically, we just relay the environment info from the server to the client. //------------------------...
As of Meteor 1.3, Meteor now exposes the NODE_ENV variable on the client by default. if (Meteor.isClient) { Meteor.startup(function () { if(process.env.NODE_ENV === "testing"){ console.log("In testing..."); } if(process.env.NODE_ENV === "production&...

Page 1 of 1