mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2026-10-27 13:16:30 -04:00
feat: add @better-auth/infra dash plugin
This commit is contained in:
4 files changed
+72
-6
No files matched your search
+17
-3
@@ -1,4 +1,6 @@
|
||||
import { drizzleAdapter } from "@better-auth/drizzle-adapter/relations-v2";
|
||||
import { dash } from "@better-auth/infra";
|
||||
import { waitUntil } from "@vercel/functions";
|
||||
import { type BetterAuthOptions, betterAuth } from "better-auth/minimal";
|
||||
import { nextCookies } from "better-auth/next-js";
|
||||
|
||||
@@ -6,16 +8,17 @@ import { db } from "@/lib/db";
|
||||
import * as schema from "@/lib/db/schema";
|
||||
|
||||
export const auth = betterAuth({
|
||||
appName: "jarv.is",
|
||||
baseURL: process.env.NEXT_PUBLIC_BASE_URL,
|
||||
database: drizzleAdapter(db, {
|
||||
provider: "pg",
|
||||
schema,
|
||||
}),
|
||||
plugins: [nextCookies()],
|
||||
plugins: [dash(), nextCookies()],
|
||||
socialProviders: {
|
||||
github: {
|
||||
clientId: process.env.AUTH_GITHUB_CLIENT_ID!,
|
||||
clientSecret: process.env.AUTH_GITHUB_CLIENT_SECRET!,
|
||||
clientId: process.env.GITHUB_CLIENT_ID!,
|
||||
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
|
||||
mapProfileToUser: (profile) => ({
|
||||
name: profile.login,
|
||||
email: profile.email,
|
||||
@@ -24,4 +27,15 @@ export const auth = betterAuth({
|
||||
}),
|
||||
},
|
||||
},
|
||||
advanced: {
|
||||
database: {
|
||||
joins: true,
|
||||
},
|
||||
backgroundTasks: {
|
||||
handler: waitUntil,
|
||||
},
|
||||
ipAddress: {
|
||||
ipAddressHeaders: ["x-vercel-forwarded-for", "x-forwarded-for"],
|
||||
},
|
||||
},
|
||||
} satisfies BetterAuthOptions);
|
||||
Reference in new issue
Block a user