File tree 2 files changed +23
-1
lines changed
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
109
109
110
110
[ Here is an up & running quickly example] ( https://github.com/brianc/node-postgres/wiki/Example )
111
111
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 )
112
134
113
135
## [ More Documentation] ( https://github.com/brianc/node-postgres/wiki )
114
136
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ var ConnectionParameters = function(config) {
55
55
this . host = val ( 'host' , config ) ;
56
56
this . password = val ( 'password' , config ) ;
57
57
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 ;
59
59
this . client_encoding = val ( "client_encoding" , config ) ;
60
60
//a domain socket begins with '/'
61
61
this . isDomainSocket = ( ! ( this . host || '' ) . indexOf ( '/' ) ) ;
You can’t perform that action at this time.
0 commit comments