mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-09 20:27:44 +00:00
chore: add mysql demo
This commit is contained in:
@@ -15,6 +15,7 @@ import { reactResetPasswordEmail } from "./email/rest-password";
|
||||
import { resend } from "./email/resend";
|
||||
import { MysqlDialect } from "kysely";
|
||||
import { createPool } from "mysql2/promise";
|
||||
import { nextCookies } from "better-auth/next-js";
|
||||
|
||||
const from = process.env.BETTER_AUTH_EMAIL || "delivered@resend.dev";
|
||||
const to = process.env.TEST_EMAIL || "";
|
||||
@@ -25,13 +26,15 @@ const libsql = new LibsqlDialect({
|
||||
});
|
||||
|
||||
const mysql = new MysqlDialect(
|
||||
createPool("mysql://user:password@localhost:3306/better_auth"),
|
||||
createPool(process.env.MYSQL_DATABASE_URL || ""),
|
||||
);
|
||||
|
||||
const dialect = process.env.USE_MYSQL ? mysql : libsql;
|
||||
|
||||
export const auth = betterAuth({
|
||||
appName: "Better Auth Demo",
|
||||
database: {
|
||||
dialect: mysql,
|
||||
dialect,
|
||||
type: "mysql",
|
||||
},
|
||||
session: {
|
||||
@@ -141,5 +144,6 @@ export const auth = betterAuth({
|
||||
multiSession(),
|
||||
oneTap(),
|
||||
oAuthProxy(),
|
||||
nextCookies(),
|
||||
],
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user