Skip to content

Instantly share code, notes, and snippets.

@qubyte
Last active August 29, 2015 14:01
Show Gist options
  • Save qubyte/87c9825abc291363dfa6 to your computer and use it in GitHub Desktop.
Save qubyte/87c9825abc291363dfa6 to your computer and use it in GitHub Desktop.
var config = require('minimist')(process.argv.slice(2));
module.exports = config;
var errors = [];
if (!config.hasOwnProperty('twitter-consumer-key')) {
errors.push('No twitter-consumer-key given.');
}
if (!config.hasOwnProperty('twitter-consumer-secret')) {
errors.push('No twitter-consumer-secret given.');
}
if (!config.hasOwnProperty('twitter-access-token')) {
errors.push('No twitter-access-token given.');
}
if (!config.hasOwnProperty('twitter-access-token-secret')) {
errors.push('No twitter-access-token-secret given.');
}
// Log critical error messages and exit.
if (errors.length) {
errors.forEach(function (message) {
console.error(message);
});
process.exit(1);
}
// Handle default configuration.
if (!config.hasOwnProperty('workers')) {
config.workers = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment