MCPcopy
hub / github.com/prisma/prisma / getSocketFromDatabaseCredentials

Function getSocketFromDatabaseCredentials

packages/migrate/src/utils/unixSocket.ts:21–33  ·  view source on GitHub ↗
(credentials: DatabaseCredentials)

Source from the content-addressed store, hash-verified

19const simpleUnixPathPattern = /^\.{0,2}\//
20
21export function getSocketFromDatabaseCredentials(credentials: DatabaseCredentials): string | null {
22 if (['postgres', 'postgresql', 'cockroachdb'].includes(credentials.type)) {
23 const host = credentials.host
24
25 if (typeof host === 'string' && simpleUnixPathPattern.test(host)) {
26 return host
27 }
28
29 return null
30 }
31
32 return credentials.socket ?? null
33}

Callers 2

getDbLocationFunction · 0.90
unixSocket.test.tsFile · 0.90

Calls 1

includesMethod · 0.80

Tested by

no test coverage detected