MCPcopy Create free account
hub / github.com/OpenPipe/OpenPipe / getPool

Function getPool

app/src/server/db.ts:28–43  ·  view source on GitHub ↗
(dbUrl: string)

Source from the content-addressed store, hash-verified

26 });
27
28export const getPool = (dbUrl: string) => {
29 // WARNING: if you start getting errors that the certificate is expired or not
30 // valid, download the latest certificate from AWS and replace the one in the
31 // codebase! It expires in August 2024. TODO: automatically the latest version
32 // into the Docker image at build time.
33 // https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html#UsingWithRDS.SSL.RegionCertificates
34 const ca = dbUrl?.includes("us-west-2.rds.amazonaws.com")
35 ? readFileSync("./prisma/us-west-2-bundle.pem").toString()
36 : undefined;
37
38 return new Pool({
39 connectionString: dbUrl,
40 ssl: ca ? { rejectUnauthorized: false, ca } : undefined,
41 max: env.PG_MAX_POOL_SIZE,
42 });
43};
44
45export const pgPool = getPool(env.DATABASE_URL);
46

Callers 2

copy-project.tsFile · 0.90
db.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected