Skip to content

Added support for setting parameters via command-line arguments, and … #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/*
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"start": "node tweetstorss.js"
},
"dependencies" : {
"node-twitter-api": "*"
"node-twitter-api": "*",
"nconf": "*"
},
"license": "MIT",
"engines": {
Expand Down
25 changes: 18 additions & 7 deletions tweetstorss.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@ var myVersion = "0.45", myProductName = "tweetsToRss", myProductUrl = "https://g
var fs = require ("fs");
var twitterAPI = require ("node-twitter-api");

var twitterConsumerKey = process.env.twitterConsumerKey;
var twitterConsumerSecret = process.env.twitterConsumerSecret;
var accessToken = process.env.twitterAccessToken;
var accessTokenSecret = process.env.twitterAccessTokenSecret;
var twitterScreenName = process.env.twitterScreenName;
var pathRssFile = process.env.pathRssFile;
// Use nconf to be able to read settings command-line if required
var nconf = require('nconf');
nconf.argv().env();

// Fetch data every minute by default, but you can turn this off and fetch the data just once (e.g. via a cron script) by setting --runEveryMinute false on the command line
nconf.defaults({'runEveryMinute': true});

var twitterConsumerKey = nconf.get('twitterConsumerKey');
var twitterConsumerSecret = nconf.get('twitterConsumerSecret');
var accessToken = nconf.get('accessToken');
var accessTokenSecret = nconf.get('accessTokenSecret');
var twitterScreenName = nconf.get('twitterScreenName');
var pathRssFile = nconf.get('pathRssFile');
var runEveryMinute = nconf.get('runEveryMinute');

var defaultRssFilePath = "rss.xml";
var flSkipReplies = true;
Expand Down Expand Up @@ -501,7 +509,10 @@ function startup () {
}

everyMinute (); //call once at startup, then every minute
setInterval (everyMinute, 60000);

if (runEveryMinute === true) {
setInterval (everyMinute, 60000);
}
}
startup ();