feat(medusa): Replace Node Redis with ioredis (#5656)
* Replaced Node Redis with ioredis * Update express.ts
This commit is contained in:
committed by
GitHub
parent
6975eacb33
commit
a53ae1e29b
5
.changeset/wicked-crews-joke.md
Normal file
5
.changeset/wicked-crews-joke.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/medusa": minor
|
||||
---
|
||||
|
||||
Replaced Node Redis with ioredis
|
||||
@@ -91,7 +91,6 @@
|
||||
"pg": "^8.11.2",
|
||||
"qs": "^6.11.2",
|
||||
"randomatic": "^3.1.1",
|
||||
"redis": "^3.0.2",
|
||||
"reflect-metadata": "^0.1.13",
|
||||
"regenerator-runtime": "^0.13.11",
|
||||
"request-ip": "^3.3.0",
|
||||
|
||||
@@ -3,7 +3,7 @@ import cookieParser from "cookie-parser"
|
||||
import { Express } from "express"
|
||||
import session from "express-session"
|
||||
import morgan from "morgan"
|
||||
import redis from "redis"
|
||||
import Redis from "ioredis"
|
||||
import { ConfigModule } from "../types/global"
|
||||
|
||||
type Options = {
|
||||
@@ -40,7 +40,10 @@ export default async ({ app, configModule }: Options): Promise<Express> => {
|
||||
|
||||
if (configModule?.projectConfig?.redis_url) {
|
||||
const RedisStore = createStore(session)
|
||||
const redisClient = redis.createClient(configModule.projectConfig.redis_url)
|
||||
const redisClient = new Redis(
|
||||
configModule.projectConfig.redis_url,
|
||||
configModule.projectConfig.redis_options ?? {}
|
||||
)
|
||||
sessionOpts.store = new RedisStore({
|
||||
client: redisClient,
|
||||
prefix: `${configModule?.projectConfig?.redis_prefix ?? ""}sess:`,
|
||||
|
||||
Reference in New Issue
Block a user