mirror of
https://github.com/Sendouc/sendou.ink.git
synced 2026-06-24 05:36:39 -05:00
21 lines
627 B
TypeScript
21 lines
627 B
TypeScript
import { createCookieSessionStorage } from "react-router";
|
|
import { ServerConfig } from "~/config.server";
|
|
import { IS_E2E_TEST_RUN } from "~/utils/e2e";
|
|
|
|
const ONE_YEAR_IN_SECONDS = 31_536_000;
|
|
|
|
export const authSessionStorage = createCookieSessionStorage({
|
|
cookie: {
|
|
name: "__session",
|
|
sameSite: "lax",
|
|
// need to specify domain so that sub-domains can access it
|
|
domain:
|
|
ServerConfig.isProduction && !IS_E2E_TEST_RUN ? "sendou.ink" : undefined,
|
|
path: "/",
|
|
httpOnly: true,
|
|
secrets: [ServerConfig.sessionSecret],
|
|
secure: ServerConfig.isProduction && !IS_E2E_TEST_RUN,
|
|
maxAge: ONE_YEAR_IN_SECONDS,
|
|
},
|
|
});
|