feat: add cookie options (#12720)
* feat: add cookie options * feat: allow configuring hmr server port via the HMR_PORT env var * support configuring HMR host and proto * allow configuring the hmr client_port * cleanup * cleanup --------- Co-authored-by: Harminder Virk <virk.officials@gmail.com> Co-authored-by: Salvador Gironès <salvadorgirones@gmail.com> Co-authored-by: Adrien de Peretti <adrien.deperetti@gmail.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { dynamicImport } from "@medusajs/utils"
|
||||
import createStore from "connect-redis"
|
||||
import cookieParser from "cookie-parser"
|
||||
import express, { Express, RequestHandler } from "express"
|
||||
@@ -5,10 +6,9 @@ import session from "express-session"
|
||||
import Redis from "ioredis"
|
||||
import morgan from "morgan"
|
||||
import path from "path"
|
||||
import { logger } from "../logger"
|
||||
import { configManager } from "../config"
|
||||
import { logger } from "../logger"
|
||||
import { MedusaRequest, MedusaResponse } from "./types"
|
||||
import { dynamicImport } from "@medusajs/utils"
|
||||
|
||||
const NOISY_ENDPOINTS_CHUNKS = ["@fs", "@id", "@vite", "@react", "node_modules"]
|
||||
|
||||
@@ -33,7 +33,7 @@ export async function expressLoader({ app }: { app: Express }): Promise<{
|
||||
sameSite = "none"
|
||||
}
|
||||
|
||||
const { http, sessionOptions } = configModule.projectConfig
|
||||
const { http, sessionOptions, cookieOptions } = configModule.projectConfig
|
||||
const sessionOpts = {
|
||||
name: sessionOptions?.name ?? "connect.sid",
|
||||
resave: sessionOptions?.resave ?? true,
|
||||
@@ -45,6 +45,7 @@ export async function expressLoader({ app }: { app: Express }): Promise<{
|
||||
sameSite,
|
||||
secure,
|
||||
maxAge: sessionOptions?.ttl ?? 10 * 60 * 60 * 1000,
|
||||
...cookieOptions,
|
||||
},
|
||||
store: null,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user