File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,6 +13,8 @@ import trackRoutes from "@/routes/track/route";
1313const createApp = ( ) : Express => {
1414 const app : Express = express ( ) ;
1515
16+ app . set ( "trust proxy" , true ) ;
17+
1618 app . use ( cors ( corsOptions ) ) ;
1719
1820 app . all ( "/api/auth/*splat" , toNodeHandler ( auth ) ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import "dotenv/config";
22
33export const env = {
44 PORT : process . env . PORT ,
5+ NODE_ENV : process . env . NODE_ENV ,
56 APP_URL : process . env . APP_URL ,
67 FRONTEND_URL : process . env . FRONTEND_URL ,
78 API_URL : process . env . API_URL ,
Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import { prismaAdapter } from "better-auth/adapters/prisma";
44import { env } from "@/config/env" ;
55import { sendWelcomeEmail } from "@/lib/actions/email" ;
66
7+ const isProd = env . NODE_ENV === "production" ;
8+
79export const auth = betterAuth ( {
810 database : prismaAdapter ( db , {
911 provider : "postgresql" ,
@@ -14,6 +16,17 @@ export const auth = betterAuth({
1416 storeSessionInDatabase : true ,
1517 preserveSessionInDatabase : true ,
1618 } ,
19+ advanced : {
20+ useSecureCookies : isProd ,
21+ cookies : {
22+ state : {
23+ attributes : {
24+ sameSite : isProd ? "none" : "lax" ,
25+ secure : isProd ,
26+ } ,
27+ } ,
28+ } ,
29+ } ,
1730 socialProviders : {
1831 google : {
1932 clientId : env . GOOGLE_CLIENT_ID || "" ,
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ const queryClient = new QueryClient({
99 defaultOptions : {
1010 queries : {
1111 staleTime : 60 * 1000 ,
12- gcTime : 1000 * 60 * 30 , // 30 minutes
12+ gcTime : 1000 * 60 * 30 ,
1313 } ,
1414 } ,
1515} ) ;
Original file line number Diff line number Diff line change 11export const env = {
22 apiBase : process . env . NEXT_PUBLIC_API_URL ,
33 appBase : process . env . NEXT_PUBLIC_APP_URL ,
4- FLAGIX_SDK_API_KEY : process . env . FLAGIX_SDK_API_KEY ,
5- FLAGIX_SDK_BASE_URL : process . env . FLAGIX_SDK_BASE_URL ,
4+ FLAGIX_SDK_API_KEY : process . env . NEXT_PUBLIC_FLAGIX_SDK_API_KEY ,
5+ FLAGIX_SDK_BASE_URL : process . env . NEXT_PUBLIC_FLAGIX_SDK_BASE_URL ,
66} ;
You can’t perform that action at this time.
0 commit comments