mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-10 04:19:32 +00:00
fix: env missing on migrate
This commit is contained in:
@@ -32,7 +32,7 @@ export default function Component() {
|
|||||||
code: totpCode,
|
code: totpCode,
|
||||||
})
|
})
|
||||||
.then((res) => {
|
.then((res) => {
|
||||||
if (res.data?.status) {
|
if (res.data?.session) {
|
||||||
setSuccess(true);
|
setSuccess(true);
|
||||||
setError("");
|
setError("");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -15,15 +15,20 @@ import { resend } from "./email/resend";
|
|||||||
const from = process.env.BETTER_AUTH_EMAIL || "delivered@resend.dev";
|
const from = process.env.BETTER_AUTH_EMAIL || "delivered@resend.dev";
|
||||||
const to = process.env.TEST_EMAIL || "";
|
const to = process.env.TEST_EMAIL || "";
|
||||||
|
|
||||||
export const auth = betterAuth({
|
const libsql = new LibsqlDialect({
|
||||||
database: new LibsqlDialect({
|
|
||||||
url: process.env.TURSO_DATABASE_URL || "",
|
url: process.env.TURSO_DATABASE_URL || "",
|
||||||
authToken: process.env.TURSO_AUTH_TOKEN || "",
|
authToken: process.env.TURSO_AUTH_TOKEN || "",
|
||||||
}),
|
});
|
||||||
|
|
||||||
|
export const auth = betterAuth({
|
||||||
|
database: {
|
||||||
|
dialect: libsql,
|
||||||
|
type: "sqlite",
|
||||||
|
},
|
||||||
emailAndPassword: {
|
emailAndPassword: {
|
||||||
enabled: true,
|
enabled: true,
|
||||||
async sendResetPassword(url, user) {
|
async sendResetPassword(url, user) {
|
||||||
const res = await resend.emails.send({
|
await resend.emails.send({
|
||||||
from,
|
from,
|
||||||
to: user.email,
|
to: user.email,
|
||||||
subject: "Reset your password",
|
subject: "Reset your password",
|
||||||
@@ -86,82 +91,6 @@ export const auth = betterAuth({
|
|||||||
bearer(),
|
bearer(),
|
||||||
admin(),
|
admin(),
|
||||||
],
|
],
|
||||||
session: {
|
|
||||||
additionalFields: {
|
|
||||||
latitude: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
longitude: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
continent: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
country: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
region: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
city: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
timezone: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
browserName: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
browserVersion: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
browserMajor: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
engineName: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
engineVersion: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
osName: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
osVersion: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
deviceVendor: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
deviceModel: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
deviceType: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
cpuArchitecture: {
|
|
||||||
type: "string",
|
|
||||||
required: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
socialProviders: {
|
socialProviders: {
|
||||||
github: {
|
github: {
|
||||||
clientId: process.env.GITHUB_CLIENT_ID || "",
|
clientId: process.env.GITHUB_CLIENT_ID || "",
|
||||||
@@ -181,5 +110,3 @@ export const auth = betterAuth({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
type A = typeof auth.$Infer.Session;
|
|
||||||
|
|||||||
@@ -98,6 +98,7 @@
|
|||||||
"commander": "^12.1.0",
|
"commander": "^12.1.0",
|
||||||
"consola": "^3.2.3",
|
"consola": "^3.2.3",
|
||||||
"defu": "^6.1.4",
|
"defu": "^6.1.4",
|
||||||
|
"dotenv": "^16.4.5",
|
||||||
"kysely": "^0.27.4",
|
"kysely": "^0.27.4",
|
||||||
"nanoid": "^5.0.7",
|
"nanoid": "^5.0.7",
|
||||||
"nanostores": "^0.11.2",
|
"nanostores": "^0.11.2",
|
||||||
|
|||||||
@@ -43,9 +43,10 @@ export const migrate = new Command("migrate")
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const db = await createKyselyAdapter(config).catch((e) => {
|
const db = await createKyselyAdapter(config).catch((e) => {
|
||||||
logger.error(e.message);
|
logger.error(e);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!db) {
|
if (!db) {
|
||||||
logger.error(
|
logger.error(
|
||||||
"Invalid database configuration. Make sure you're not using adapters. Migrate command only works with built-in Kysely adapter.",
|
"Invalid database configuration. Make sure you're not using adapters. Migrate command only works with built-in Kysely adapter.",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
import { Command } from "commander";
|
import { Command } from "commander";
|
||||||
import { migrate } from "./commands/migrate";
|
import { migrate } from "./commands/migrate";
|
||||||
import { generate } from "./commands/generate";
|
import { generate } from "./commands/generate";
|
||||||
|
import "dotenv/config";
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
const program = new Command().name("better-auth");
|
const program = new Command().name("better-auth");
|
||||||
|
|||||||
3
pnpm-lock.yaml
generated
3
pnpm-lock.yaml
generated
@@ -1480,6 +1480,9 @@ importers:
|
|||||||
defu:
|
defu:
|
||||||
specifier: ^6.1.4
|
specifier: ^6.1.4
|
||||||
version: 6.1.4
|
version: 6.1.4
|
||||||
|
dotenv:
|
||||||
|
specifier: ^16.4.5
|
||||||
|
version: 16.4.5
|
||||||
kysely:
|
kysely:
|
||||||
specifier: ^0.27.4
|
specifier: ^0.27.4
|
||||||
version: 0.27.4
|
version: 0.27.4
|
||||||
|
|||||||
Reference in New Issue
Block a user