Please let us pass METEOR_SETTINGS via a file

438 views
Skip to first unread message

Dan Dascalescu

unread,
Jul 15, 2014, 6:07:01 PM7/15/14
to meteo...@googlegroups.com
I'm posting here at David Glasser's suggestion in ticket #1116, echoing the voices of several users who have asked for Meteor.settings to be readable from a file in addition to (or even instead of) an environment variable. The main reasons for this request are:

  1. Environment variables are almost always single-line, and the ecosystem has evolved in that direction. Meteor.settings consists of multiple lines of JSON.
  2. Setting environment variables is platform-specific, and may require different escaping of special characters during manipulation from launch scripts (since the user is practically forced to do so, e.g. export METEOR_SETTINGS=$(cat whatever.json)), while a JSON file would be cross-platform and a single source of truth, without the need for pre-processing.
  3. In development mode (meteor run), --settings takes a file. For consistency, this could happen in production as well.
  4. Debugging environment variables is significantly more painful than debugging JSON.
  5. Some platforms may limit the size of environment variables, while the JSON can grow quite large.
  6. Storing settings in a file would enable file watching and automatic restart of the app when settings change (e.g. via forever, pm2, node-supervisor)
  7. pm2, a more powerful alternative to forever, takes app settings in a JSON file. That file can include environment variables for the app. However, passing Meteor's JSON settings as an environment variable inside the pm2 JSON is an exercise in frustration: a JSON encoded as a value string inside another JSON. JSON doesn't support multi-line values, double quotes need to be escaped etc.
  8. Users have been dissatisfied with and confused by the current approach.
At StockBase, we found it much more convenient to use the Assets API for now:

    App.settings = EJSON.parse(Assets.getText('production.json'));

Of course, that doesn't push the public key to the client, so a real fix would be highly desirable.

Austin Rivas

unread,
Jul 17, 2014, 2:15:05 PM7/17/14
to meteo...@googlegroups.com
I agree 100%,

I have managed to circumvent this issue by creating my own launcher and bundling scripts that read from a configuration  file, but I would definitely prefer a solution that is integrated into meteor.

If you are interested I would be happy to share my solution.

- Austin

Abigail Watson

unread,
Jul 17, 2014, 7:08:58 PM7/17/14
to meteo...@googlegroups.com
+1 
Would be much appreciated.  
Reply all
Reply to author
Forward
0 new messages