| 162 | |
| 163 | // convert pg-connection-string ssl config to a ClientConfig.ConnectionOptions |
| 164 | function toConnectionOptions(sslConfig) { |
| 165 | const connectionOptions = Object.entries(sslConfig).reduce((c, [key, value]) => { |
| 166 | // we explicitly check for undefined and null instead of `if (value)` because some |
| 167 | // options accept falsy values. Example: `ssl.rejectUnauthorized = false` |
| 168 | if (value !== undefined && value !== null) { |
| 169 | c[key] = value |
| 170 | } |
| 171 | |
| 172 | return c |
| 173 | }, Object.create(null)) |
| 174 | |
| 175 | return connectionOptions |
| 176 | } |
| 177 | |
| 178 | // convert pg-connection-string config to a ClientConfig |
| 179 | function toClientConfig(config) { |