Process.env in Meteor 1.3.2.4; server/deployment execution issue


#1

I am having trouble using the process.env module in Meteor; the confusing part is the JS works works on my development machine but NOT when deployed to my server.

Test Example - Doing a Npm package DNS lookup (code snippet below)

  • If I assign the value of: Meteor.settings.server_name, using my settings.json file, the DNS lookup works fine. This works on BOTH my development machine and my server (…this verifies I set up my name servers properly).

  • If I assign the value of: Meteor.settings.server_name, using the process.env module (ex. Meteor.settings.server_name = process.env.METEOR_SERVER_NAME, the DNS lookup works on my development machine but NOT my server (ip is “undefined”)

Any help would be greatly appreciated.

var dns = Npm.require(‘dns’);
var lookup = Meteor.wrapAsync(dns.lookup);
console.log(‘server_name: ’ + Meteor.settings.server_name’);
try {
var ip = lookup(Meteor.settings.server_name);
console.log(ip);
} catch (e) {
console.log(ip);
}


NPM package in Meteor 1.3.2.4; server execution issue