I have tried:
alert(process.env.MONGO_URL);
everywhere is my Meteor project and always get:
Uncaught ReferenceError: process is not defined
I'm not sure what I'm doing wrong. Do I need to include something? Meteor is written in javascript and all the same APIs are available so why isn't process defined?
You could try
if (Meteor.isServer) {
console.log(process.env);
}
You must get the environment from the server side. Try the following.
//In the client side
if (Meteor.isClient) {
Meteor.call('getMongoUrlEnv', function(err, results) {
alert("Mongo_URL=",results);
});
}
if (Meteor.isServer) {
Meteor.methods({
getMongoUrlEnv: function(){
var mongoURL = process.env.MONGO_URL;
return mongoURL;
}
});
}