File tree 1 file changed +22
-1
lines changed
1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,28 @@ const Sequelize = require('sequelize')
2
2
const pkg = require ( '../../package.json' )
3
3
const dbName = process . env . NODE_ENV === 'test' ? `${ pkg . name } -test` : pkg . name
4
4
const dbUrl = process . env . DATABASE_URL || `postgres://localhost:5432/${ dbName } `
5
- const client = new Sequelize ( dbUrl , { logging : false , operatorsAliases : false } )
5
+ let config ;
6
+ if ( process . env . DATABASE_URL ) {
7
+ config = {
8
+ logging : false ,
9
+ operatorsAliases : false ,
10
+ dialect : "postgres" ,
11
+ protocol : "postgres" ,
12
+ ssl : true ,
13
+ dialectOptions : {
14
+ ssl : {
15
+ require : true ,
16
+ rejectUnauthorized : false ,
17
+ } ,
18
+ } ,
19
+ }
20
+ } else {
21
+ config = {
22
+ logging : false ,
23
+ operatorsAliases : false ,
24
+ }
25
+ }
26
+ const client = new Sequelize ( dbUrl , config )
6
27
7
28
module . exports = client
8
29
You can’t perform that action at this time.
0 commit comments