Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow url option that's forwarded to ioredis #67

Merged
merged 1 commit into from
Jan 15, 2020
Merged

Allow url option that's forwarded to ioredis #67

merged 1 commit into from
Jan 15, 2020

Conversation

jgodson
Copy link
Contributor

@jgodson jgodson commented Dec 5, 2019

Fix for #64 and allows passing a url in the options for koa-redis (url was not a valid option in v4.0.0, though it's mentioned in the readme still). This change also makes it backwards compatible with 3.

If present, this is passed to ioredis as the first argument, with the other options as the second argument see here for details

new Redis([port], [host], [options])

[port] - Port of the Redis server, or a URL string(see the examples below), or the options object(see the third argument).

[host] - Host of the Redis server, when the first argument is a URL string, this argument is an object represents the options.

This allows ioredis to parse the url string instead of forcing you to pass each parameter separately.

As an example:

redisStore({
  url: 'redis://user:password@redis-service.com:6379/'
})

would be the equivalent of new Redis('redis://user:password@redis-service.com:6379/'); in ioredis

@coveralls
Copy link

coveralls commented Dec 5, 2019

Coverage Status

Coverage increased (+0.05%) to 97.391% when pulling 841c46f on jgodson:master into 118943e on koajs:master.

@dead-horse
Copy link
Member

can you add a test case for this feature ?

@jgodson
Copy link
Contributor Author

jgodson commented Dec 5, 2019

@dead-horse done!

@jgodson
Copy link
Contributor Author

jgodson commented Jan 6, 2020

@dead-horse any chance you could have a look at this?

@jgodson
Copy link
Contributor Author

jgodson commented Jan 15, 2020

Or maybe @niftylettuce, could you 👀 by any chance?

@niftylettuce niftylettuce merged commit d38730a into koajs:master Jan 15, 2020
@niftylettuce
Copy link
Contributor

v4.0.1 released to npm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants