Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

changed from optimist to yargs, fixed password issue, added more gene…

…ric ENV var
  • Loading branch information...
commit 6a04008dac4bc4df836ec05be5fef4ac8571218b 1 parent 4b54a88
@switzer switzer authored
Showing with 7 additions and 6 deletions.
  1. +6 −5 app.js
  2. +1 −1  package.json
View
11 app.js
@@ -40,7 +40,7 @@ var express = require('express'),
RedisStore = require('connect-redis')(express);
// Parse arguments
-var optimist = require('optimist')
+var optimist = require('yargs')
.usage('Usage: $0 --config-file [file]')
.alias('c', 'config-file')
.alias('h', 'help')
@@ -69,14 +69,15 @@ 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);
+ console.log(rtg);
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);
+var db = redis.createClient(config.redis.port || process.env.REDIS_PORT_6379_TCP_PORT, config.redis.host || process.env.REDIS_PORT_6379_TCP_PORT);
db.auth(config.redis.password);
db.on("error", function(err) {
View
2  package.json
@@ -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",
Please sign in to comment.
Something went wrong with that request. Please try again.