Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autodetect Redis type discoverer when using redis SSL URI #1260

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading