From 10ca1ae8bdb6152523c78c0552579b0d08ce0b45 Mon Sep 17 00:00:00 2001 From: Robert Jefe Lindstaedt Date: Mon, 17 Apr 2017 00:55:27 +0200 Subject: [PATCH] fix: options missing when called storage backend --- lib/persistence/redis.js | 22 +++++++++++----------- lib/server.js | 5 ++++- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/lib/persistence/redis.js b/lib/persistence/redis.js index 5bc68da..b64e54e 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 711d31b..01e55d9 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);