vary express & express-session options depending on environment (fixes #21)
This commit is contained in:
parent
cd62fc4f67
commit
e09b78cf82
|
@ -16,8 +16,12 @@ export const session = expressSession({
|
||||||
prefix: process.env.REDIS_SESSION_PREFIX || "canvas_session:",
|
prefix: process.env.REDIS_SESSION_PREFIX || "canvas_session:",
|
||||||
}),
|
}),
|
||||||
cookie: {
|
cookie: {
|
||||||
sameSite: "none",
|
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
|
...(process.env.NODE_ENV === "development"
|
||||||
|
? { sameSite: "none" }
|
||||||
|
: {
|
||||||
|
secure: true,
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -27,6 +31,11 @@ export class ExpressServer {
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.app = express();
|
this.app = express();
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === "production") {
|
||||||
|
this.app.set("trust proxy", 1);
|
||||||
|
}
|
||||||
|
|
||||||
this.httpServer = http.createServer(this.app);
|
this.httpServer = http.createServer(this.app);
|
||||||
|
|
||||||
if (process.env.SERVE_CLIENT) {
|
if (process.env.SERVE_CLIENT) {
|
||||||
|
|
Loading…
Reference in New Issue