Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Passing in config file for the production instance of my Meteor app?

Tags:

node.js

meteor

So on my local machine, when I boot up the Meteor app, I pass in a json file to specify app settings like this

meteor --settings local.json

This seems to work. However, as specified in the meteor.com documentation (http://docs.meteor.com/#deploying) when deploying the app in your own infrastructure, you need to bundle up your app using "meteor bundle" and then run it as node instance like so

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

I'm able to do this and have the app deployed on my server. However, I'm not sure how I'm meant to pass the json file with my config settings in.

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 --settings a Meteor thing or a Node thing? If it's the latter, how do I pass in my JSON file?

like image 753
Diskdrive Avatar asked Jan 04 '14 07:01

Diskdrive


1 Answers

--settings is a meteor thing.

In production you can use the environmental variable instead since --settings is meant for use with meteor run or just meteor

From the docs:

Meteor.settings contains deployment-specific configuration options. You can initialize settings by passing the --settings option (which takes a file containing JSON data) to meteor run or meteor deploy, or by setting your server process's METEOR_SETTINGS environment variable to a JSON string

So something like this could work:

PORT=3000 MONGO_URL=mongodb://localhost:27017/myapp METEOR_SETTINGS=$(cat prod.json) node bundle/main.js
like image 115
Tarang Avatar answered Nov 16 '22 22:11

Tarang