mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
Trying to fix auth cookie.
This commit is contained in:
parent
e6ea744f0a
commit
716e2e7d28
1 changed files with 10 additions and 4 deletions
|
|
@ -6,6 +6,15 @@ import { sessions, users } from '../../schema';
|
||||||
|
|
||||||
const adapter = new DrizzlePostgreSQLAdapter(db, sessions, users);
|
const adapter = new DrizzlePostgreSQLAdapter(db, sessions, users);
|
||||||
|
|
||||||
|
let domain;
|
||||||
|
if (process.env.NODE_ENV === 'production' || process.env.VERCEL_ENV === 'production') {
|
||||||
|
domain = 'boredgame.vercel.app';
|
||||||
|
} else if (process.env.VERCEL_ENV === 'preview' || process.env.VERCEL_ENV === 'development') {
|
||||||
|
domain = process.env.VERCEL_BRANCH_URL;
|
||||||
|
} else {
|
||||||
|
domain = 'localhost';
|
||||||
|
}
|
||||||
|
|
||||||
export const lucia = new Lucia(adapter, {
|
export const lucia = new Lucia(adapter, {
|
||||||
getSessionAttributes: (attributes) => {
|
getSessionAttributes: (attributes) => {
|
||||||
return {
|
return {
|
||||||
|
|
@ -30,10 +39,7 @@ export const lucia = new Lucia(adapter, {
|
||||||
// set to `true` when using HTTPS
|
// set to `true` when using HTTPS
|
||||||
secure: process.env.NODE_ENV === 'production',
|
secure: process.env.NODE_ENV === 'production',
|
||||||
sameSite: 'strict',
|
sameSite: 'strict',
|
||||||
domain:
|
domain
|
||||||
process.env.NODE_ENV === 'production'
|
|
||||||
? process.env.VERCEL_URL ?? 'boredgame.vercel.app'
|
|
||||||
: 'localhost'
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue