Socket
Socket
Sign inDemoInstall

redis-url-parse

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    redis-url-parse

Spread a Redis URL string into a configuration object.


Version published
Weekly downloads
3.3K
decreased by-11.02%
Maintainers
1
Install size
14.5 kB
Created
Weekly downloads
 

Changelog

Source

2.0.0

We now require Node 6.13.0. For older versions, use a 1.x release.

Breaking

  • [4851f268ed] - Use WHATWG URL parsing and break old Node compatibility (#10)

Chore

  • Updated dependencies (#5, #6, #7)

Readme

Source

Redis URL Parse

Build Status npm version

Spread a Redis URL string into a configuration object.

Module usage

const redisUrlParse = require('redis-url-parse')

// Defaults to localhost:6379/0
redisUrlParse('redis://')
//=> {host: 'localhost', port: 6379, database: '0', password: undefined}

// But you can change databases by adding a path
redisUrlParse('redis:///1')
//=> {host: 'localhost', port: 6379, database: '1', password: undefined}

// And change hosts
redisUrlParse('redis://example.com:39143/')
//=> {host: 'example.com', port: 39143, database: '0', password: undefined}

// And even add passwords
redisUrlParse('redis://:n9y25ah7@example.com:39143/')
//=> {host: 'example.com', port: 39143, database: '0', password: 'n9y25ah7'}

// If you add a username, it's ignored
redisUrlParse('redis://user:hunter2@example.com:39143/')
//=> {host: 'example.com', port: 39143, database: '0', password: 'hunter2'}

// If your password uses special characters, you may need to URI encode it
redisUrlParse('redis://:my%3Asuper%21secure%3Fpassword@example.com:39143/')
//=> {host: 'example.com', port: 39143, database: '0', password: 'my:super!secure?password'}

Complete example

const redisUrlParse = require('redis-url-parse')
redisUrlParse(process.env.REDIS_URL)  // redis://
//=> {host: 'localhost', port: 6379, database: '0', password: undefined}

Prior art

  • parse-redis-url not maintained and has an extremely awkward interface require('parse-redis-url')(null).parse(url)
  • redis-url not maintained and requires redis as a requirement
  • redis-url-parser not maintained and only works if your URL has a password

Keywords

FAQs

Last updated on 24 Oct 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc