Created
October 15, 2013 22:57
-
-
Save ritikm/6999942 to your computer and use it in GitHub Desktop.
Pure-JS method of importing settings into Meteor.js. This file is put in server/lib.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
environment = process.env.NODE_ENV || "development"; | |
var settings = { | |
development: { | |
public: {}, | |
private: {} | |
}, | |
staging: { | |
public: {}, | |
private: {} | |
}, | |
production: { | |
public: {}, | |
private: {} | |
} | |
}; | |
if (!process.env.METEOR_SETTINGS) { | |
console.log("=> No METEOR_SETTINGS passed in, using locally defined settings."); | |
if (environment === "production") { | |
Meteor.settings = settings.production; | |
} else if (environment === "staging") { | |
Meteor.settings = settings.staging; | |
} else { | |
Meteor.settings = settings.development; | |
} | |
// Push a subset of settings to the client. | |
if (Meteor.settings && Meteor.settings.public) { | |
__meteor_runtime_config__.PUBLIC_SETTINGS = Meteor.settings.public; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Regardless of if the repo is private or public, you should never push things like private keys or passwords to other services. Assume everyone at GitHub can see them (they can).
You can create your production settings file locally, then
scp
it to your server initially, and add it to your.gitignore
file.