Passing in the configuration file for the project instance of my Meteor application?

So, on my local machine, when I download the Meteor application, I pass the json file to specify application parameters, such as

meteor --settings local.json 

It seems to work. However, as indicated in the meteor.com documentation ( http://docs.meteor.com/#deploying ) when deploying the application in your own infrastructure, you need to bundle the application using a "meteor package" and then run it as an instance of node, for example So

 PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp node bundle/main.js 

I can do this and the application is deployed to my server. However, I am not sure how I should pass the json file with the configuration settings.

 PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp --settings prod.json node bundle/main.js PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp node bundle/main.js --settings prod.json 

Is there a --settings thing meteor or thing node? If this is the last, how can I go in my JSON file?

+7
meteor
source share
2 answers

--settings is a meteor thing.

In production, you can use the environment variable since --settings is for use with meteor run or just meteor

From the docs:

Meteor.settings contains deployment-specific configuration options. You can initialize the settings by passing the --settings parameter (which takes a file containing JSON data) to start a meteor or meteor shower or by setting the METEOR_SETTINGS server environment variable in the JSON string

So something like this might work:

 PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp METEOR_SETTINGS=$(cat prod.json) node bundle/main.js 
+11
source share

You can also create a start script, as shown below:

https://www.eventedmind.com/classes/setting-up-meteor-projects/a-sample-start-script

Code for it: https://github.com/cmather/meteor-start .

A script, as it simplifies the use of various development and production environments.

0
source share

All Articles