File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -109,6 +109,28 @@ It's __highly recommended__ you read the documentation for [pg-pool](https://git
109109
110110[ Here is an up & running quickly example] ( https://github.com/brianc/node-postgres/wiki/Example )
111111
112+ ### connect to self signed Postgresql server
113+
114+ Use following config to connect a Postgresql Server self signed:
115+
116+ ```
117+ var config = {
118+ database : 'database-name', //env var: PGDATABASE
119+ host : "host-or-ip", //env var: PGPORT
120+ port : 5432, //env var: PGPORT
121+ max : 100, // max number of clients in the pool
122+ idleTimeoutMillis: 30000,
123+ ssl : {
124+ rejectUnauthorized : false,
125+ ca : fs.readFileSync("/path/to/server-certificates/maybe/root.crt").toString(),
126+ key : fs.readFileSync("/path/to/client-key/maybe/postgresql.key").toString(),
127+ cert : fs.readFileSync("/path/to/client-certificates/maybe/postgresql.crt").toString(),
128+ }
129+ };
130+
131+ ```
132+
133+ For more information about ` config.ssl ` check [ TLS (SSL) of nodejs] ( https://nodejs.org/dist/latest-v4.x/docs/api/tls.html )
112134
113135## [ More Documentation] ( https://github.com/brianc/node-postgres/wiki )
114136
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ var ConnectionParameters = function(config) {
5555 this . host = val ( 'host' , config ) ;
5656 this . password = val ( 'password' , config ) ;
5757 this . binary = val ( 'binary' , config ) ;
58- this . ssl = typeof config . ssl === 'boolean ' ? config . ssl : useSsl ( ) ;
58+ this . ssl = typeof config . ssl === 'undefined ' ? useSsl ( ) : config . ssl ;
5959 this . client_encoding = val ( "client_encoding" , config ) ;
6060 //a domain socket begins with '/'
6161 this . isDomainSocket = ( ! ( this . host || '' ) . indexOf ( '/' ) ) ;
You can’t perform that action at this time.
0 commit comments