Skip to content

Instantly share code, notes, and snippets.

@BretFisher
Created January 15, 2015 16:06
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BretFisher/756593f57c20e8a2f45a to your computer and use it in GitHub Desktop.
Save BretFisher/756593f57c20e8a2f45a to your computer and use it in GitHub Desktop.
Meteor App Check for Ensuring You're Using --settings
// lets complain to server command line if you forgot --settings when running Meteor
Meteor.startup(function () {
if (Meteor.isServer) {
if (Object.keys(Meteor.settings).length === 0) {
console.log("You forgot to run Meteor with --settings!");
}
}
});
@adeubank
Copy link

Pro tip, for sure. This is a great way to help developers get introduced to Meteor or a Meteor project.

Have you seen this way of passing initializing settings? https://github.com/awatson1978/meteor-cookbook/blob/master/cookbook/environment-detection.md#configuring-an-app-based-on-different-environemnts

I have been using that technique in a few projects now.

@BretFisher
Copy link
Author

That's excellent. It's actually what we do in Node.js projects but I never looked at repeating it in Meteor. Thanks.

@samhatoum
Copy link

@scottmackenzzz
Copy link

Sorry to sound super daft, but why should you start Meteor apps with --settings? What are --settings and how are they best used? From what I gather it's a way of setting environment variables? Would love a noob guide to settings.

@queso
Copy link

queso commented Jan 23, 2015

Settings are a way to have a per environment variable easily controller by the settings file. Think of things like s3 keys, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment