redis-connection-object-generator
v0.2.1
Published
Parse a given url to generate a connection object to be used in redis client modules (supports sentinel schema urls)
Downloads
1
Readme
Installation
Using npm:
npm install --save redis-connection-object-generator
Using
const redisConnectionObjectGenerator = require('redis-connection-object-generator')
redisConnectionObjectGenerator('redis://:@127.0.0.1:6379/0')
// { host: '127.0.0.1', port: 6379, family: 0, password: '', db: 0 }
redisConnectionObjectGenerator(`sentinel://:[email protected]:6380,127.0.0.1:6379,127.0.0.1:6378/service_name:mymaster`)
/*
{ name: 'mymaster',
sentinels:
[ { host: '127.0.0.1', port: 6380 },
{ host: '127.0.0.1', port: 6379 },
{ host: '127.0.0.1', port: 6378 } ],
password: 'password' }
*/