| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- import { MultipleCodeBlock } from 'ui-patterns/MultipleCodeBlock'
- import type { StepContentProps } from '@/components/interfaces/ConnectSheet/Connect.types'
- import { IS_PLATFORM } from '@/lib/constants'
- const ContentFile = ({ connectionStringPooler }: StepContentProps) => {
- const files = [
- {
- name: '.env.local',
- language: 'bash',
- code:
- connectionStringPooler.ipv4SupportedForDedicatedPooler &&
- connectionStringPooler.transactionDedicated
- ? `
- # Connect to Briven via connection pooling.
- DATABASE_URL="${connectionStringPooler.transactionDedicated}?pgbouncer=true"
- # Direct connection to the database. Used for migrations.
- DIRECT_URL="${connectionStringPooler.sessionDedicated}"
- `
- : connectionStringPooler.transactionDedicated &&
- !connectionStringPooler.ipv4SupportedForDedicatedPooler
- ? `
- # Connect to Briven via Shared Connection Pooler
- DATABASE_URL="${connectionStringPooler.transactionShared}?pgbouncer=true"
- # Direct connection to the database through Shared Pooler (supports IPv4/IPv6). Used for migrations.
- DIRECT_URL="${connectionStringPooler.sessionShared}"
- # If your network supports IPv6 or you purchased IPv4 addon, use dedicated pooler
- # DATABASE_URL="${connectionStringPooler.transactionDedicated}?pgbouncer=true"
- # DIRECT_URL="${connectionStringPooler.sessionDedicated}"
- `
- : `
- # Connect to Briven ${IS_PLATFORM ? 'via connection pooling' : ''}
- DATABASE_URL="${IS_PLATFORM ? `${connectionStringPooler.transactionShared}?pgbouncer=true` : connectionStringPooler.direct}"
- # Direct connection to the database. Used for migrations
- DIRECT_URL="${IS_PLATFORM ? connectionStringPooler.sessionShared : connectionStringPooler.direct}"
- `,
- },
- {
- name: 'prisma/schema.prisma',
- language: 'bash',
- code: `
- generator client {
- provider = "prisma-client-js"
- }
- datasource db {
- provider = "postgresql"
- url = env("DATABASE_URL")
- directUrl = env("DIRECT_URL")
- }
- `,
- },
- ]
- return <MultipleCodeBlock files={files} />
- }
- export default ContentFile
|