Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions graphql/server/src/schema.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { printSchema, getIntrospectionQuery, buildClientSchema } from 'graphql'
import { ConstructivePreset, makePgService } from 'graphile-settings'
import { makeSchema } from 'graphile-build'
import { getPgPool } from 'pg-cache'
import { buildConnectionString, getPgPool } from 'pg-cache'
import type { GraphileConfig } from 'graphile-config'
import * as http from 'node:http'
import * as https from 'node:https'
Expand All @@ -20,7 +20,13 @@ export async function buildSchemaSDL(opts: BuildSchemaOptions): Promise<string>
// Get pool config for connection string
const pool = getPgPool({ database })
const poolConfig = (pool as any).options || {}
const connectionString = `postgres://${poolConfig.user || 'postgres'}:${poolConfig.password || ''}@${poolConfig.host || 'localhost'}:${poolConfig.port || 5432}/${database}`
const connectionString = buildConnectionString(
poolConfig.user || 'postgres',
poolConfig.password || '',
poolConfig.host || 'localhost',
poolConfig.port || 5432,
database,
)

// Build v5 preset
const preset: GraphileConfig.Preset = {
Expand Down