How to set environment variable in Meteor server?

I would like to test the Google meteorite packet on a remote server.

settings.json

{
  "public" : {
    "ga": {
      "account":"UA-dfgddhdh-5"
    }
  }
}

On the local server, I just pass the parameter --settings. I looked at http://meteorpedia.com/read/Environment_Variables and http://docs.meteor.com/#/full/meteor_settings , but it is still unclear what I have to do to set this environment variable inside meteor deploy. Thanks for the help!

EDIT:

if (Meteor.isServer) {
  Meteor.startup(function () {
    var settings = JSON.parse(
      '{"public" : {"ga": {"account":"UA-5555555-5"}}}'
    );
    process.env.METEOR_SETTINGS = settings;
  });
}

Is this the right approach? In addition, the https://github.com/datariot/meteor-ganalytics package requires this option before downloading the package itself. How to provide this?

+4
source share
1 answer

:

process.env.ENV_VARIABLE = "something"

$ export ENV_VARIABLE='something'

+10

All Articles