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