mirror of
https://github.com/SunRed/haste-server.git
synced 2024-11-23 17:50:19 +01:00
Allow redistogo
This commit is contained in:
parent
ff8ef54e34
commit
4efc5d47d9
3 changed files with 16 additions and 4 deletions
|
@ -8,9 +8,11 @@ var winston = require('winston');
|
|||
// options[db] - The db to use (default 0)
|
||||
// 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;
|
||||
if (!RedisDocumentStore.client) {
|
||||
if (client) {
|
||||
RedisDocumentStore.client = client;
|
||||
} else if (!RedisDocumentStore.client) {
|
||||
RedisDocumentStore.connect(options);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
"dependencies": {
|
||||
"winston": "0.6.2",
|
||||
"connect": "1.9.2",
|
||||
"redis-url": "0.1.0",
|
||||
"uglify-js": "1.3.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
13
server.js
13
server.js
|
@ -34,8 +34,17 @@ if (!config.storage) {
|
|||
if (!config.storage.type) {
|
||||
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
|
||||
if (config.recompressStaticAssets) {
|
||||
|
|
Loading…
Reference in a new issue