content.tsx62 lines · main
1import { MultipleCodeBlock } from 'ui-patterns/MultipleCodeBlock'
2
3import type { StepContentProps } from '@/components/interfaces/ConnectSheet/Connect.types'
4import { IS_PLATFORM } from '@/lib/constants'
5
6const ContentFile = ({ connectionStringPooler }: StepContentProps) => {
7 const files = [
8 {
9 name: '.env.local',
10 language: 'bash',
11 code:
12 connectionStringPooler.ipv4SupportedForDedicatedPooler &&
13 connectionStringPooler.transactionDedicated
14 ? `
15# Connect to Briven via connection pooling.
16DATABASE_URL="${connectionStringPooler.transactionDedicated}?pgbouncer=true"
17
18# Direct connection to the database. Used for migrations.
19DIRECT_URL="${connectionStringPooler.sessionDedicated}"
20 `
21 : connectionStringPooler.transactionDedicated &&
22 !connectionStringPooler.ipv4SupportedForDedicatedPooler
23 ? `
24# Connect to Briven via Shared Connection Pooler
25DATABASE_URL="${connectionStringPooler.transactionShared}?pgbouncer=true"
26
27# Direct connection to the database through Shared Pooler (supports IPv4/IPv6). Used for migrations.
28DIRECT_URL="${connectionStringPooler.sessionShared}"
29
30# If your network supports IPv6 or you purchased IPv4 addon, use dedicated pooler
31# DATABASE_URL="${connectionStringPooler.transactionDedicated}?pgbouncer=true"
32# DIRECT_URL="${connectionStringPooler.sessionDedicated}"
33 `
34 : `
35# Connect to Briven ${IS_PLATFORM ? 'via connection pooling' : ''}
36DATABASE_URL="${IS_PLATFORM ? `${connectionStringPooler.transactionShared}?pgbouncer=true` : connectionStringPooler.direct}"
37
38# Direct connection to the database. Used for migrations
39DIRECT_URL="${IS_PLATFORM ? connectionStringPooler.sessionShared : connectionStringPooler.direct}"
40`,
41 },
42 {
43 name: 'prisma/schema.prisma',
44 language: 'bash',
45 code: `
46generator client {
47 provider = "prisma-client-js"
48}
49
50datasource db {
51 provider = "postgresql"
52 url = env("DATABASE_URL")
53 directUrl = env("DIRECT_URL")
54}
55 `,
56 },
57 ]
58
59 return <MultipleCodeBlock files={files} />
60}
61
62export default ContentFile