MCPcopy
hub / github.com/brianc/node-postgres / toConnectionOptions

Function toConnectionOptions

packages/pg-connection-string/index.js:164–176  ·  view source on GitHub ↗
(sslConfig)

Source from the content-addressed store, hash-verified

162
163// convert pg-connection-string ssl config to a ClientConfig.ConnectionOptions
164function 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
179function toClientConfig(config) {

Callers 1

toClientConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected