refactor(env): centralize auth env handling and prefer BETTER_AUTH_BASE_URL
This commit is contained in:
@@ -3,6 +3,7 @@ import { drizzleAdapter } from 'better-auth/adapters/drizzle';
|
||||
|
||||
import { db } from './db/client';
|
||||
import { schema } from './db/schema';
|
||||
import { getBetterAuthBaseUrl, getRequiredEnv } from './utils/env';
|
||||
import { hashPassword, verifyPassword } from './utils/password';
|
||||
|
||||
const trustedOrigins = process.env.BETTER_AUTH_TRUSTED_ORIGINS
|
||||
@@ -24,8 +25,8 @@ export const auth = betterAuth({
|
||||
verify: async ({ hash, password }) => verifyPassword(password, hash),
|
||||
},
|
||||
},
|
||||
secret: process.env.BETTER_AUTH_SECRET,
|
||||
baseURL: process.env.BETTER_AUTH_URL,
|
||||
secret: getRequiredEnv('BETTER_AUTH_SECRET'),
|
||||
baseURL: getBetterAuthBaseUrl(),
|
||||
trustedOrigins,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user