chore: seminarhof customer project
This commit is contained in:
29
packages/functions/src/wirings/auth.wiring.ts
Normal file
29
packages/functions/src/wirings/auth.wiring.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { betterAuth } from 'better-auth'
|
||||
import { pikkuBetterAuth } from '#pikku/pikku-types.gen.js'
|
||||
|
||||
export const auth = pikkuBetterAuth(async ({ kysely, secrets }) => {
|
||||
const BETTER_AUTH_SECRET = await secrets.getSecret('BETTER_AUTH_SECRET')
|
||||
|
||||
return betterAuth({
|
||||
secret: BETTER_AUTH_SECRET,
|
||||
database: { db: kysely as any, type: 'sqlite' },
|
||||
emailAndPassword: { enabled: true },
|
||||
advanced: { database: { generateId: 'uuid' } },
|
||||
user: {
|
||||
additionalFields: {
|
||||
role: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
defaultValue: 'client',
|
||||
input: false,
|
||||
},
|
||||
locale: {
|
||||
type: 'string',
|
||||
required: false,
|
||||
defaultValue: 'de',
|
||||
input: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user