Skip to content

Commit 520ba6f

Browse files
committed
Revert "Use pg-connection-string for ?sslrootcert support"
This reverts commit 776c17d.
1 parent 776c17d commit 520ba6f

File tree

6 files changed

+12
-52
lines changed

6 files changed

+12
-52
lines changed

@app/server/__tests__/helpers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { Request, Response } from "express";
22
import { ExecutionResult, graphql, GraphQLSchema } from "graphql";
33
import { Pool, PoolClient } from "pg";
4-
import { parse } from "pg-connection-string";
54
import {
65
createPostGraphileSchema,
76
PostGraphileOptions,
@@ -106,7 +105,9 @@ interface ICtx {
106105
let ctx: ICtx | null = null;
107106

108107
export const setup = async () => {
109-
const rootPgPool = new Pool(parse(process.env.TEST_DATABASE_URL) as any);
108+
const rootPgPool = new Pool({
109+
connectionString: process.env.TEST_DATABASE_URL,
110+
});
110111

111112
const options = getPostGraphileOptions({ rootPgPool });
112113
const schema = await createPostGraphileSchema(

@app/server/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"passport": "^0.4.1",
4040
"passport-github2": "^0.1.11",
4141
"pg": "^8.0.3",
42-
"pg-connection-string": "^2.2.0",
4342
"postgraphile": "^4.7.0",
4443
"redis": "^3.0.2",
4544
"source-map-support": "^0.5.13",

@app/server/src/middleware/installDatabasePools.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { Express } from "express";
22
import { Pool } from "pg";
3-
import { parse } from "pg-connection-string";
43

54
import { getShutdownActions } from "../app";
65

@@ -26,12 +25,16 @@ function swallowPoolError(_error: Error) {
2625

2726
export default (app: Express) => {
2827
// This pool runs as the database owner, so it can do anything.
29-
const rootPgPool = new Pool(parse(process.env.DATABASE_URL!) as any);
28+
const rootPgPool = new Pool({
29+
connectionString: process.env.DATABASE_URL,
30+
});
3031
rootPgPool.on("error", swallowPoolError);
3132
app.set("rootPgPool", rootPgPool);
3233

3334
// This pool runs as the unprivileged user, it's what PostGraphile uses.
34-
const authPgPool = new Pool(parse(process.env.AUTH_DATABASE_URL!) as any);
35+
const authPgPool = new Pool({
36+
connectionString: process.env.AUTH_DATABASE_URL,
37+
});
3538
authPgPool.on("error", swallowPoolError);
3639
app.set("authPgPool", authPgPool);
3740

@app/worker/package.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"private": true,
44
"version": "0.0.0",
55
"scripts": {
6-
"gw": "node -r @app/config/env dist/index.js",
6+
"gw": "cd dist && node -r @app/config/env ../node_modules/.bin/graphile-worker",
77
"build": "tsc -b",
88
"start": "yarn gw",
9-
"dev": "node -r @app/config/env --inspect=9757 dist/index.js --watch",
9+
"dev": "cd dist && node -r @app/config/env --inspect=9757 ../node_modules/.bin/graphile-worker --watch",
1010
"install-db-schema": "mkdir -p dist && yarn gw --schema-only"
1111
},
1212
"dependencies": {
@@ -22,8 +22,6 @@
2222
"lodash": "^4.17.15",
2323
"mjml": "^4.6.2",
2424
"nodemailer": "^6.4.6",
25-
"pg": "^8.0.3",
26-
"pg-connection-string": "^2.2.0",
2725
"tslib": "^1.11.1"
2826
}
2927
}

@app/worker/src/index.ts

Lines changed: 0 additions & 41 deletions
This file was deleted.

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12329,7 +12329,7 @@ [email protected]:
1232912329
resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-0.1.3.tgz#da1847b20940e42ee1492beaf65d49d91b245df7"
1233012330
integrity sha1-2hhHsglA5C7hSSvq9l1J2RskXfc=
1233112331

12332-
pg-connection-string@^2.0.0, pg-connection-string@^2.1.0, pg-connection-string@^2.2.0:
12332+
pg-connection-string@^2.0.0, pg-connection-string@^2.1.0:
1233312333
version "2.2.0"
1233412334
resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.2.0.tgz#caab4d38a9de4fdc29c9317acceed752897de41c"
1233512335
integrity sha512-xB/+wxcpFipUZOQcSzcgkjcNOosGhEoPSjz06jC89lv1dj7mc9bZv6wLVy8M2fVjP0a/xN0N988YDq1L0FhK3A==

0 commit comments

Comments
 (0)