store express sessions in redis
This commit is contained in:
12
src/app.ts
12
src/app.ts
@@ -12,7 +12,9 @@ import configuration from "@feathersjs/configuration";
|
||||
import socketio from "@feathersjs/socketio";
|
||||
import session from "express-session";
|
||||
import cookieParser from "cookie-parser";
|
||||
|
||||
import RedisStore from "connect-redis";
|
||||
import { createClient } from "redis";
|
||||
import config from "config";
|
||||
import type { Application } from "./declarations";
|
||||
|
||||
import { logger } from "./logger";
|
||||
@@ -35,9 +37,15 @@ app.use(
|
||||
app.use(cookieParser());
|
||||
app.use(
|
||||
session({
|
||||
store: new RedisStore({
|
||||
prefix: "walias:",
|
||||
client: createClient({
|
||||
url: config.get("redis.url"),
|
||||
}),
|
||||
}),
|
||||
secret: randomUUID(),
|
||||
resave: false,
|
||||
saveUninitialized: true,
|
||||
saveUninitialized: false,
|
||||
cookie: { secure: false },
|
||||
}),
|
||||
);
|
||||
|
@@ -94,10 +94,12 @@ export class AliasesService<ServiceParams extends AliasesParams = AliasesParams>
|
||||
|
||||
const addressInfoResponse = await Promise.any(
|
||||
emails
|
||||
.filter((email: string) => email.endsWith(config.get("wildDuck.preferredDomain")))
|
||||
.map((email: string) =>
|
||||
wildDuckClient.get<Alias>(`addresses/resolve/${email}`),
|
||||
),
|
||||
.filter((email: string) =>
|
||||
email.endsWith(config.get("wildDuck.preferredDomain")),
|
||||
)
|
||||
.map((email: string) =>
|
||||
wildDuckClient.get<Alias>(`addresses/resolve/${email}`),
|
||||
),
|
||||
);
|
||||
|
||||
return addressInfoResponse.data.user;
|
||||
|
Reference in New Issue
Block a user