Permalink
Browse files

Merge pull request #175 from adjs/master

Modify REDISTOGO_URL parameters; other misc improvements
  • Loading branch information...
2 parents 4b54a88 + 174a391 commit 5c08aec11452f48b715281f96f3b6fab016084b1 @mansilladev mansilladev committed Apr 8, 2014
Showing with 7 additions and 7 deletions.
  1. +6 −6 app.js
  2. +1 −1 package.json
View
12 app.js
@@ -40,16 +40,16 @@ var express = require('express'),
RedisStore = require('connect-redis')(express);
// Parse arguments
-var optimist = require('optimist')
+var yargs = require('yargs')
.usage('Usage: $0 --config-file [file]')
.alias('c', 'config-file')
.alias('h', 'help')
.describe('c', 'Specify the config file location')
.default('c', './config.json');
-var argv = optimist.argv;
+var argv = yargs.argv;
if (argv.help) {
- optimist.showHelp();
+ yargs.showHelp();
process.exit(0);
}
@@ -69,11 +69,11 @@ var defaultDB = '0';
if(config.redis) {
config.redis.database = config.redis.database || defaultDB;
-if (process.env.REDISTOGO_URL) {
- var rtg = require("url").parse(process.env.REDISTOGO_URL);
+if (process.env.REDISTOGO_URL || process.env.REDIS_URL) {
+ var rtg = require("url").parse(process.env.REDISTOGO_URL || process.env.REDIS_URL);
config.redis.host = rtg.hostname;
config.redis.port = rtg.port;
- config.redis.password = rtg.auth.split(":")[1];
+ config.redis.password = rtg.auth && rtg.auth.split(":")[1] ? rtg.auth.split(":")[1] : '';
}
var db = redis.createClient(config.redis.port, config.redis.host);
View
@@ -31,7 +31,7 @@
"redis": "0.8.3",
"querystring": "0.1.0",
"supervisor": ">= 0.5.x",
- "optimist": ">= 0.6.0"
+ "yargs": ">= 1.2.1"
},
"devDependencies": {},
"main": "index",

0 comments on commit 5c08aec

Please sign in to comment.