Running Meteor Build under Node with the argument of settings

Normally in development I would use meteor run --settings settings.json. This works great and can view the settings in a browser using Meteor.settingsthe console.

Now I was created for production, using meteor build, I looked through the documentation, and there is settingsnowhere to add in the assembly process .

So, the assembly is done, and I have my file .tar.gz, it loads to its original state, and then I unpack / compress the folder and run the start of the script.

It enters the program with npm start, and the package.json section looks like this (ignore the stop script);

{
  "name": "myapp",
  "scripts": {
    "start": "node main.js --settings settings.json",
    "stop": "killall node"
  }
}

When I look at my application, it does not collect these settings. It is as if in a set he did not expect arguments. I also tried to use forever in advance, but I also had no joy.

Any help would be appreciated, start wishing me never to worry about the Meteor :)

+4
source share
1 answer

You can refer to the Meteor Guide> Production> Deployment and Monitoring> Environment Variables and Parameters

Settings . They are located in the JSON object set via the --settingsMeteor command line flag or gated into the environment variable METEOR_SETTINGS.

, , GUI CLI, .

, SO:

, :

METEOR_SETTINGS='{"key":"value"}' node main.js

bash cat : $(cat settings.json)

+3

Source: https://habr.com/ru/post/1651553/


All Articles