Primeiro commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
export const sessionConfig = {
|
||||
password: process.env["SESSION_SECRET"] || "",
|
||||
name: "slalog-session",
|
||||
maxAge: 60 * 60 * 12,
|
||||
cookie: {
|
||||
httpOnly: true,
|
||||
sameSite: "lax" as const,
|
||||
path: "/",
|
||||
secure: process.env["NODE_ENV"] === "production",
|
||||
},
|
||||
};
|
||||
|
||||
export interface SessionUser {
|
||||
userId: string;
|
||||
}
|
||||
|
||||
export function assertSessionConfig() {
|
||||
if (!sessionConfig.password || sessionConfig.password.length < 32) {
|
||||
throw new Error("SESSION_SECRET must be set with at least 32 characters.");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user