mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
144e832cdc
Co-authored-by: Mathias Åhsberg <mathias.ahsberg@resurs.se>
27 lines
598 B
JavaScript
27 lines
598 B
JavaScript
'use strict';
|
|
|
|
const knex = require('knex');
|
|
|
|
module.exports.createDb = function({
|
|
db,
|
|
poolMin = 2,
|
|
poolMax = 20,
|
|
databaseSchema,
|
|
getLogger,
|
|
}) {
|
|
const logger = getLogger('db-pool.js');
|
|
return knex({
|
|
client: 'pg',
|
|
version: db.version,
|
|
connection: db,
|
|
pool: { min: poolMin, max: poolMax },
|
|
searchPath: databaseSchema,
|
|
log: {
|
|
debug: msg => logger.debug(msg),
|
|
info: msg => logger.info(msg),
|
|
warn: msg => logger.warn(msg),
|
|
error: msg => logger.error(msg),
|
|
},
|
|
});
|
|
};
|