Permalink
Browse files

Merge pull request #148 from haebin/noredis-support

If Redis configuration is not defined in the config.json then just run without it.
  • Loading branch information...
2 parents 748b2e7 + eb89558 commit 1c76d40d77aefaa51167c3284c14a065b2428bf3 @mtougeron mtougeron committed Mar 25, 2014
Showing with 8 additions and 0 deletions.
  1. +8 −0 app.js
View
8 app.js
@@ -50,6 +50,7 @@ try {
// Redis connection
//
var defaultDB = '0';
+if(config.redis) {
config.redis.database = config.redis.database || defaultDB;
if (process.env.REDISTOGO_URL) {
@@ -67,6 +68,7 @@ db.on("error", function(err) {
console.log("Error " + err);
}
});
+}
//
// Load API Configs
@@ -97,6 +99,7 @@ app.configure(function() {
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser());
+if(config.redis) {
app.use(express.session({
secret: config.sessionSecret,
store: new RedisStore({
@@ -107,6 +110,11 @@ app.configure(function() {
'maxAge': 1209600000
})
}));
+} else {
+ app.use(express.session({
+ secret: config.sessionSecret
+ }));
+}
// Global basic authentication on server (applied if configured)
if (config.basicAuth && config.basicAuth.username && config.basicAuth.password) {

0 comments on commit 1c76d40

Please sign in to comment.