Typically when developing I would use meteor run --settings settings.json
. This works fine and can view the settings in the browser with Meteor.settings
on the console.
I am now build for production, using meteor build
, I've looked at the documentation and there is nowhere to add settings
during the build process.
So the build runs and I have my .tar.gz
file, it's loaded to production and then I untar/compress the folder and run the start 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 app it is not collecting these settings. It is as if when bundled it doesn't expect the arguements. I also tried using forever beforehand, but I had no joy with this either.
Any help would appreciated, start to wish I never bothered with Meteor :)
You can refer to Meteor Guide > Production > Deployment and Monitoring > Environment variables and Settings
Settings. These are in a JSON object set via either the
--settings
Meteor command-line flag or stringified into theMETEOR_SETTINGS
environment variable.
As for setting environment variables, if you use a 3rd party host, you may have a GUI or CLI to define them.
Otherwise, you should have plenty resources including on SO:
In short, it should look like:
METEOR_SETTINGS='{"key":"value"}' node main.js
You can also try the bash cat
command to extract the content of a file: $(cat settings.json)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With