From 4888fc248cfb11da4c3bd30279bc495e8c78d669 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Fri, 8 Jul 2022 14:27:16 +0300 Subject: [PATCH] Try Cypress in Github Actions 6 --- .github/workflows/main.yml | 4 +--- app/modules/auth/session.server.ts | 6 ++++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 88c2421f7..45b2561eb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -20,9 +20,7 @@ jobs: BASE_URL: http://localhost:4455 PORT: 4455 DB_PATH: db.sqlite3 - SESSION_SECRET: secret - DISCORD_CLIENT_ID: 123 - DISCORD_CLIENT_SECRET: secret + NODE_ENV: test - name: Prettier run: npm run prettier:check - name: Lint TS diff --git a/app/modules/auth/session.server.ts b/app/modules/auth/session.server.ts index 45a6f83d4..9a22c4741 100644 --- a/app/modules/auth/session.server.ts +++ b/app/modules/auth/session.server.ts @@ -3,14 +3,16 @@ import invariant from "tiny-invariant"; const ONE_YEAR_IN_SECONDS = 31_536_000; -invariant(process.env["SESSION_SECRET"]); +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"]], + secrets: [process.env["SESSION_SECRET"] ?? "secret"], secure: process.env.NODE_ENV === "production", maxAge: ONE_YEAR_IN_SECONDS, },