Accessing Meteor Settings in a Self-Owned Production Environment -
according meteor's documentation, can include settings file through command line provide deployment-specific settings.
however, --settings option seems available through run , deploy commands. if running meteor application on own infrastructure - outlined in running on own infrastructure section of documentation - there doesn't seem way specify deployment-specific settings file anywhere in process.
is there way access meteor settings in production environment, running on own infrastructure?
yes, include settings contents in environmental variable meteor_settings. example,
export meteor_settings='{"privatekey":"my_key", "public":{"publickey":"my_public_key", "anotherpublickey":"more_key"}}'
and run meteor app normal.
this populate meteor.settings object has normal. settings above,
meteor.settings.privatekey == "my_key" #only on server meteor.settings.public.publickey == "my_public_key" #server , client meteor.settings.public.anotherpublickey == "more_key" #server , client for our project, use upstart script , include there (although upstart has different syntax). however, if starting normal shell script, need include export statement before node command. could, example, have script like:
export meteor_settings='{"stuff":"real"}' node /path/to/bundle/main.js or
meteor_settings='{"stuff":"real"}' node /path/to/bundle/main.js
you can find more information bash variables here.
Comments
Post a Comment