-
Notifications
You must be signed in to change notification settings - Fork 135
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
feat: add upstash-redis
driver
#289
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## main #289 +/- ##
==========================================
- Coverage 77.96% 77.37% -0.60%
==========================================
Files 29 30 +1
Lines 3418 3496 +78
Branches 521 522 +1
==========================================
+ Hits 2665 2705 +40
- Misses 752 790 +38
Partials 1 1
|
Hey there! quick question: why did you install secondly: we can provde a db for unit tests for free, just let me know :) |
Hello there! @vercel/kv is already a driver supported by unstorage, this PR doesn't install it. I didn't know their package was just a wrapper. On providing us with a DB, I think that would be great ! |
Do you mind resolving the conflicts @Hebilicious ? |
ba6ea2d
to
89f5394
Compare
Sure. For full context, when vercel-kv was added in #213, @redis/upstash was added as a dependency because it is a vercel-kv dependency, so that makes it easier for pnpm users to use unstorage without shamefully-hoist. This PR adds a redis-upstash driver for the use case where you want to use upstash without vercel (which I encountered recently) I'll add this to the PR description. |
src/drivers/redis-upstash.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can simplify driver name to upstash with an alias to upstash-redis as this is only upstash/kv storage option now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made the changes here and in the docs. I still think for future proof we should be explicit with then name, as upstash could add a new product that unstorage could support.
Hi dear @chronark thanks for reaching out and for your offer about the CI plan. I would ideally love to have a proper "unit" test for both drivers. I think we can mock the HTTP client with upstash API. If you have a tool or package that can help in this regard it would be awesome! Also, feel free to reach me via discord (pi0) if you would like to work closer on upstash integrations I can invite you to the unjs discord channel. Off topic: Regarding vercel-kv, the main reason for having a wrapper is that it allows having "zero configuration" integration with their platform / provided environment variables - also any changes needed in the future. If there are other hosting options that provided upstash integration, we probably have to either use their packages or make a wrapper driver. |
Thanks for the updates @Hebilicious β€οΈ |
@pi0 we don't have any true unit test library or similar, I'm running all of our tests against a real upstash db or in a docker container :/ I'm leaving upstash soon, joining your discord now probably won't help much unfortunately. if you want credits for testing against real dbs, just let us know here: [email protected] and ideally reference this comment :D |
π Linked issue
Resolves #288
β Type of change
π Description
This PR adds a upstash-redis driver for redis support on edge platforms.
For full context, when vercel-kv was added in #213, @redis/upstash was added as a dependency because it is a vercel-kv dependency, so that makes it easier for pnpm users.
This PR adds a redis-upstash driver for the use case where you want to use upstash without vercel (which I encountered recently)
The tests are running locally, and need env variables to work in the CI.
We should create an unjs upstash db, or mock the client.
π Checklist