Skip to content

Commit

Permalink
Merge pull request #1260 from Freezystem/fix.discoverer-rediss-uri-no…
Browse files Browse the repository at this point in the history
…t-detected-as-redis

autodetect Redis type discoverer when using redis SSL URI
  • Loading branch information
icebob committed Nov 26, 2023
2 parents 6a58b17 + d249c27 commit 3889543
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/registry/discoverers/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ function resolve(opt) {
let DiscovererClass = getByName(opt);
if (DiscovererClass) return new DiscovererClass();

if (opt.startsWith("redis://")) return new Discoverers.Redis(opt);
if (opt.startsWith("redis://") || opt.startsWith("rediss://"))
return new Discoverers.Redis(opt);

if (opt.startsWith("etcd3://")) return new Discoverers.Etcd3(opt);

Expand Down
6 changes: 6 additions & 0 deletions test/unit/registry/discoverers/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ describe("Test Discoverers resolver", () => {
expect(discoverer.opts.redis).toEqual("redis://redis-server:6379");
});

it("should resolve Redis reporter from SSL connection string", () => {
const discoverer = Discoverers.resolve("rediss://redis-server:6379");
expect(discoverer).toBeInstanceOf(Discoverers.Redis);
expect(discoverer.opts.redis).toEqual("rediss://redis-server:6379");
});

it("should resolve Redis discoverer from obj", () => {
const options = { heartbeatInterval: 8 };
const discoverer = Discoverers.resolve({ type: "Redis", options });
Expand Down

0 comments on commit 3889543

Please sign in to comment.