Allow redistogo

This commit is contained in:
John Crepezzi 2012-09-27 11:46:53 -04:00
parent ff8ef54e34
commit 4efc5d47d9
3 changed files with 16 additions and 4 deletions

View file

@ -8,9 +8,11 @@ var winston = require('winston');
// options[db] - The db to use (default 0) // options[db] - The db to use (default 0)
// options[expire] - The time to live for each key set (default never) // options[expire] - The time to live for each key set (default never)
var RedisDocumentStore = function(options) { var RedisDocumentStore = function(options, client) {
this.expire = options.expire; this.expire = options.expire;
if (!RedisDocumentStore.client) { if (client) {
RedisDocumentStore.client = client;
} else if (!RedisDocumentStore.client) {
RedisDocumentStore.connect(options); RedisDocumentStore.connect(options);
} }
}; };

View file

@ -16,6 +16,7 @@
"dependencies": { "dependencies": {
"winston": "0.6.2", "winston": "0.6.2",
"connect": "1.9.2", "connect": "1.9.2",
"redis-url": "0.1.0",
"uglify-js": "1.3.3" "uglify-js": "1.3.3"
}, },
"devDependencies": { "devDependencies": {

View file

@ -34,8 +34,17 @@ if (!config.storage) {
if (!config.storage.type) { if (!config.storage.type) {
config.storage.type = 'file'; config.storage.type = 'file';
} }
var Store = require('./lib/document_stores/' + config.storage.type);
var preferredStore = new Store(config.storage); var Store, preferredStore;
if (config.storage.type === 'redistogo') {
var redisClient = require('redis-url').connect(process.env.REDISTOGO_URL);
Store = require('./lib/document_stores/redis');
preferredStore = new Store(config.storage, redisClient);
}
else {
Store = require('./lib/document_stores/' + config.storage.type);
preferredStore = new Store(config.storage);
}
// Compress the static javascript assets // Compress the static javascript assets
if (config.recompressStaticAssets) { if (config.recompressStaticAssets) {