johny-cache
Version:
Easy distributed caching for Node.js
16 lines • 657 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseRedisConnectionString = parseRedisConnectionString;
function parseRedisConnectionString(redisUrl) {
if (!redisUrl.startsWith('redis://')) {
redisUrl = `redis://${redisUrl}`;
}
const url = new URL(redisUrl);
const host = url.hostname;
const port = Number(url.port) || 6379;
const username = url.username || undefined;
const password = url.password || undefined;
const db = url.pathname ? parseInt(url.pathname.slice(1), 10) : 0;
return { host, port, username, password, db };
}
//# sourceMappingURL=redis-conig-parser.js.map