parse-redis-url

Parses Redis URL into a node_redis config object

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
parse-redis-url
600.0.29 years ago11 years agoMinified + gzip package size for parse-redis-url in KB

Readme

parse-redis-url
A module for parsing redis://.. URLs into noderedis-friendly options.
Can also create actual client instance for your convenience.
Build Status

Usage

var redis = require('redis');
var parseRedisUrl = require('parse-redis-url')(redis);
var url = 'redis://dummy:password@example.com:5555/42';

// create a new client from URL

parseRedisUrl.createClient(url, function(err, client) {
   if (err) return callback(err);
   // do something with client
});



// simply parse URL for connection options
// please note that username is not used by Redis,
// so it's not included in the result

var options = parseRedisUrl.parse(url);
// { host: 'example.com',
//  port: 5555,
//  password: 'password',
//  database: 42 }