diff --git a/lib/persistence/redis.js b/lib/persistence/redis.js index 5bc68da5..b64e54e9 100644 --- a/lib/persistence/redis.js +++ b/lib/persistence/redis.js @@ -197,24 +197,24 @@ util.inherits(RedisPersistence, AbstractPersistence); RedisPersistence.prototype._buildClient = function() { var options = this.options.redisOptions || {}; - if (this.options.url) { - options.url = this.options.url; + if (this.options.backend.url) { + options.url = this.options.backend.url; } - - if (this.options.host) { - options.host = this.options.host; + + if (this.options.backend.host) { + options.host = this.options.backend.host; } - if (this.options.port) { - options.port = this.options.port; + if (this.options.backend.port) { + options.port = this.options.backend.port; } - if (this.options.db) { - options.db = this.options.db; + if (this.options.backend.db) { + options.db = this.options.backend.db; } - if (this.options.password) { - options.password = this.options.password; + if (this.options.backend.password) { + options.password = this.options.backend.password; } return new Redis(options); diff --git a/lib/server.js b/lib/server.js index 711d31b6..01e55d96 100755 --- a/lib/server.js +++ b/lib/server.js @@ -192,6 +192,9 @@ function Server(opts, callback) { } } + // make sure storage backend get options + that.modernOpts.persistence.backend = opts.backend + that.persistence = persistenceFactory(that.modernOpts.persistence, done); that.persistence.wire(that); } else { @@ -618,7 +621,7 @@ Server.prototype.attachHttpServer = function(server, path) { if (path) { opt.path = path; } - + ws.createServer(opt, function(stream) { var conn = new Connection(stream); new Client(conn, that);