2
0

Make the default workspace plan configurable

Set it with a `DEFAULT_WORKSPACE_PLAN` env variable

Closes #152
This commit is contained in:
Baptiste Arnaud
2023-01-10 11:18:43 +01:00
parent f1fa5358e9
commit b142dc18eb
8 changed files with 85 additions and 78 deletions

View File

@ -3,7 +3,6 @@ import {
PrismaClient,
Prisma,
Invitation,
Plan,
WorkspaceRole,
WorkspaceInvitation,
Session,
@ -12,6 +11,7 @@ import type { Adapter, AdapterUser } from 'next-auth/adapters'
import cuid from 'cuid'
import { got } from 'got'
import { generateId } from 'utils'
import { parseWorkspaceDefaultPlan } from '@/features/workspace'
type InvitationWithWorkspaceId = Invitation & {
typebot: {
@ -53,11 +53,7 @@ export function CustomAdapter(p: PrismaClient): Adapter {
name: data.name
? `${data.name}'s workspace`
: `My workspace`,
...(process.env.ADMIN_EMAIL === data.email
? { plan: Plan.LIFETIME }
: {
plan: Plan.FREE,
}),
plan: parseWorkspaceDefaultPlan(data.email),
},
},
},