support pg-promise init options (#3613)
* pg-promise init options * add database init options * Create PostgresInitOptions.spec.js * Update PostgresInitOptions.spec.js * Update PostgresInitOptions.spec.js * add PostgresInitOptions test * Add files via upload * linebreaks CRLF to LF * modify postgresURI to test environment * modify pg error code to 42P01 * fix reconfigureServer callback
This commit is contained in:
committed by
Florent Vilmart
parent
52828683ba
commit
f3f81b692b
@@ -1,4 +1,4 @@
|
||||
const pgp = require('pg-promise')();
|
||||
|
||||
const parser = require('./PostgresConfigParser');
|
||||
|
||||
export function createClient(uri, databaseOptions) {
|
||||
@@ -13,11 +13,13 @@ export function createClient(uri, databaseOptions) {
|
||||
dbOptions[key] = databaseOptions[key];
|
||||
}
|
||||
|
||||
const initOptions = dbOptions.initOptions || {};
|
||||
const pgp = require('pg-promise')(initOptions);
|
||||
const client = pgp(dbOptions);
|
||||
|
||||
if (dbOptions.pgOptions) {
|
||||
for (const key in dbOptions.pgOptions) {
|
||||
client.pg.defaults[key] = dbOptions.pgOptions[key];
|
||||
pgp.pg.defaults[key] = dbOptions.pgOptions[key];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user