Skip to content

Commit bb850f6

Browse files
committed
[fix] Now using unix domain sockets.
- Improves security. - Works around mistakenly using iPV6 instead of iPV4 (prisma/prisma#10211 * That bug is still somewhat unfixed, it's just a workaround like said earlier.
1 parent 65fbad6 commit bb850f6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

server.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,18 @@ export function makeServer(config: BackendConfig,
1717
onQueryParams.log = [{ level: "query", emit: "event" }]
1818
}
1919

20+
// Found on https://github.com/prisma/prisma/issues/6088, and we really want Unix Sockets for security.
21+
const unixDomainSocketParams = {
22+
__internal: {
23+
useUds: true,
24+
},
25+
} as ConstructorParameters<typeof PrismaClient>[0];
26+
2027
const prisma = new PrismaClient({
21-
datasources: {db: {url: config.LHD_DB_URL}},
22-
...onQueryParams
23-
})
28+
datasources: { db: { url: config.LHD_DB_URL } },
29+
...unixDomainSocketParams,
30+
...onQueryParams,
31+
});
2432

2533
if (onQuery) {
2634
(prisma as any).$on("query", onQuery)

0 commit comments

Comments
 (0)