File tree Expand file tree Collapse file tree 6 files changed +12
-52
lines changed Expand file tree Collapse file tree 6 files changed +12
-52
lines changed Original file line number Diff line number Diff line change 1
1
import { Request , Response } from "express" ;
2
2
import { ExecutionResult , graphql , GraphQLSchema } from "graphql" ;
3
3
import { Pool , PoolClient } from "pg" ;
4
- import { parse } from "pg-connection-string" ;
5
4
import {
6
5
createPostGraphileSchema ,
7
6
PostGraphileOptions ,
@@ -106,7 +105,9 @@ interface ICtx {
106
105
let ctx : ICtx | null = null ;
107
106
108
107
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
+ } ) ;
110
111
111
112
const options = getPostGraphileOptions ( { rootPgPool } ) ;
112
113
const schema = await createPostGraphileSchema (
Original file line number Diff line number Diff line change 39
39
"passport" : " ^0.4.1" ,
40
40
"passport-github2" : " ^0.1.11" ,
41
41
"pg" : " ^8.0.3" ,
42
- "pg-connection-string" : " ^2.2.0" ,
43
42
"postgraphile" : " ^4.7.0" ,
44
43
"redis" : " ^3.0.2" ,
45
44
"source-map-support" : " ^0.5.13" ,
Original file line number Diff line number Diff line change 1
1
import { Express } from "express" ;
2
2
import { Pool } from "pg" ;
3
- import { parse } from "pg-connection-string" ;
4
3
5
4
import { getShutdownActions } from "../app" ;
6
5
@@ -26,12 +25,16 @@ function swallowPoolError(_error: Error) {
26
25
27
26
export default ( app : Express ) => {
28
27
// 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
+ } ) ;
30
31
rootPgPool . on ( "error" , swallowPoolError ) ;
31
32
app . set ( "rootPgPool" , rootPgPool ) ;
32
33
33
34
// 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
+ } ) ;
35
38
authPgPool . on ( "error" , swallowPoolError ) ;
36
39
app . set ( "authPgPool" , authPgPool ) ;
37
40
Original file line number Diff line number Diff line change 3
3
"private" : true ,
4
4
"version" : " 0.0.0" ,
5
5
"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 " ,
7
7
"build" : " tsc -b" ,
8
8
"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" ,
10
10
"install-db-schema" : " mkdir -p dist && yarn gw --schema-only"
11
11
},
12
12
"dependencies" : {
22
22
"lodash" : " ^4.17.15" ,
23
23
"mjml" : " ^4.6.2" ,
24
24
"nodemailer" : " ^6.4.6" ,
25
- "pg" : " ^8.0.3" ,
26
- "pg-connection-string" : " ^2.2.0" ,
27
25
"tslib" : " ^1.11.1"
28
26
}
29
27
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 12329
12329
resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-0.1.3.tgz#da1847b20940e42ee1492beaf65d49d91b245df7"
12330
12330
integrity sha1-2hhHsglA5C7hSSvq9l1J2RskXfc=
12331
12331
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:
12333
12333
version "2.2.0"
12334
12334
resolved "https://registry.yarnpkg.com/pg-connection-string/-/pg-connection-string-2.2.0.tgz#caab4d38a9de4fdc29c9317acceed752897de41c"
12335
12335
integrity sha512-xB/+wxcpFipUZOQcSzcgkjcNOosGhEoPSjz06jC89lv1dj7mc9bZv6wLVy8M2fVjP0a/xN0N988YDq1L0FhK3A==
You can’t perform that action at this time.
0 commit comments