Skip to content

Commit

Permalink
Merge pull request #128 from ember-cli-deploy/bug/url
Browse files Browse the repository at this point in the history
Fix issue where ioredis constructor args were being passed in an unsupported manner
  • Loading branch information
lukemelia authored Oct 22, 2021
2 parents b3ea9e5 + ffd2abd commit 1d4e55f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
9 changes: 7 additions & 2 deletions lib/redis.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ module.exports = CoreObject.extend({
RedisLib = require('ioredis');
}

this._client = new RedisLib(libOptions);

if (libOptions.url) {
let url = libOptions.url;
delete libOptions.url;
this._client = new RedisLib(url, libOptions);
} else {
this._client = new RedisLib(libOptions);
}
this._maxRecentUploads = options.maxRecentUploads || 10;
this._allowOverwrite = options.allowOverwrite || false;
this._activationSuffix = options.activationSuffix || 'current';
Expand Down
24 changes: 14 additions & 10 deletions tests/unit/index-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,16 @@ describe("redis plugin", function() {
plugin.configure(context);
plugin.readConfig("redisDeployClient");

assert.isTrue(
redisLibStub.calledWith({
host: "somehost",
port: 1234,
db: 4,
tls: { rejectUnauthorized: false }
})
assert.deepEqual(
redisLibStub.lastCall.args,
[
{
host: "somehost",
port: 1234,
db: 4,
tls: { rejectUnauthorized: false }
}
]
);
});

Expand All @@ -126,8 +129,9 @@ describe("redis plugin", function() {
plugin.configure(context);
plugin.readConfig("redisDeployClient");

assert.isTrue(
redisLibStub.calledWith({ url: "redis://:[email protected]:6379/4" })
assert.deepEqual(
redisLibStub.lastCall.args,
["redis://:[email protected]:6379/4", {}],
);
});

Expand All @@ -153,7 +157,7 @@ describe("redis plugin", function() {
plugin.readConfig("redisDeployClient");

assert.isTrue(
redisLibStub.calledWith({ url: "redis://:[email protected]:6379/4" })
redisLibStub.calledWith("redis://:[email protected]:6379/4")
);
});

Expand Down

0 comments on commit 1d4e55f

Please sign in to comment.