Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Commit

Permalink
fix(redis): fix matching logic for redis host/port
Browse files Browse the repository at this point in the history
  • Loading branch information
ostowe committed May 11, 2020
1 parent 4567097 commit 3fc9c6f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/core/services/cacheService.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,18 @@ const getService = () => {
return defaultService;
}

const match = hostAndPort.match(
/((redis:\/\/([\w]*:)?)?[\w.\-_@]+):([\d]+)/
);

// Must be in the format `host:port`
if (! hostAndPort || ! hostAndPort.match(/^[\w\-_.]+:\d+$/)) {
if (! hostAndPort || ! match) {
return defaultService;
}

const [host, port] = hostAndPort.split(':');
const host = match[1];
const port = match[4];

const client = new Redis({
host,
port,
Expand Down

0 comments on commit 3fc9c6f

Please sign in to comment.