mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-03-26 20:34:43 -05:00
20 lines
569 B
TypeScript
20 lines
569 B
TypeScript
import { createCookieSessionStorage } from "@remix-run/node";
|
|
import invariant from "tiny-invariant";
|
|
|
|
const ONE_YEAR_IN_SECONDS = 31_536_000;
|
|
|
|
if (process.env.NODE_ENV === "production") {
|
|
invariant(process.env["SESSION_SECRET"], "SESSION_SECRET is required");
|
|
}
|
|
export const authSessionStorage = createCookieSessionStorage({
|
|
cookie: {
|
|
name: "_session",
|
|
sameSite: "lax",
|
|
path: "/",
|
|
httpOnly: true,
|
|
secrets: [process.env["SESSION_SECRET"] ?? "secret"],
|
|
secure: process.env.NODE_ENV === "production",
|
|
maxAge: ONE_YEAR_IN_SECONDS,
|
|
},
|
|
});
|