File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed
Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -41,21 +41,28 @@ export const auth = betterAuth({
4141 "https://dev.trycomp.ai" ,
4242 ] ,
4343 advanced : {
44- database : {
45- // This will enable us to fall back to DB for ID generation.
46- // It's important so we can use custom IDs specified in Prisma Schema.
47- generateId : false ,
48- } ,
44+ database : {
45+ // This will enable us to fall back to DB for ID generation.
46+ // It's important so we can use custom IDs specified in Prisma Schema.
47+ generateId : false ,
48+ } ,
4949 } ,
5050 secret : process . env . AUTH_SECRET ! ,
5151 plugins : [
5252 organization ( {
5353 async sendInvitationEmail ( data ) {
5454 const isLocalhost = process . env . NODE_ENV === "development" ;
5555 const protocol = isLocalhost ? "http" : "https" ;
56- const domain = isLocalhost
57- ? "localhost:3000"
58- : "app.trycomp.ai" ;
56+
57+ const betterAuthUrl = process . env . BETTER_AUTH_URL ;
58+ const isDevEnv = betterAuthUrl ?. includes ( "dev.trycomp.ai" ) ;
59+ const isProdEnv = betterAuthUrl ?. includes ( "app.trycomp.ai" ) ;
60+
61+ const domain = isDevEnv
62+ ? "dev.trycomp.ai"
63+ : isProdEnv
64+ ? "app.trycomp.ai"
65+ : "localhost:3000" ;
5966 const inviteLink = `${ protocol } ://${ domain } /auth?inviteCode=${ data . invitation . id } ` ;
6067
6168 await sendInviteMemberEmail ( {
You can’t perform that action at this time.
0 commit comments