File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,13 +27,15 @@ const pgp = pgPromise(initOptions)
2727// 1114 is OID for timestamp in Postgres
2828pgp . pg . types . setTypeParser ( 1114 , ( str : string ) => new Date ( `${ str } GMT` ) )
2929
30+ // SSL connection configuration
31+ const sslConfig = ProcessEnv . pgSsl ? { rejectUnauthorized : ! ProcessEnv . pgSslAllowUnauthorized } : false
32+
3033const configCommon = {
3134 // How long a client is allowed to remain idle before being closed
3235 idleTimeoutMillis : 30000 ,
3336 // Max number of clients in the pool
3437 max : 30 ,
35- // Whether to use ssl connections
36- ssl : ProcessEnv . pgSsl ,
38+ ssl : sslConfig ,
3739}
3840
3941const config = ProcessEnv . dbUrl
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ export const ProcessEnv = {
2626 pgPort : Number ( pgPort ) ,
2727 pgDatabase,
2828 pgSsl : process . env . PGSSL === 'true' ,
29+ pgSslAllowUnauthorized : process . env . PGSSL_ALLOW_UNAUTHORIZED === 'true' ,
2930 disableDbMigrations : process . env . DISABLE_DB_MIGRATIONS === 'true' ,
3031
3132 // Express
You can’t perform that action at this time.
0 commit comments