@szegedsw/lib-node
Version:
A little framework published by Szeged Software Zrt. in order to enhance api endpoint security and create reuseable code. Email module, Logging system, and much more. Further improvements are expected.
32 lines • 1.24 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.postgresClose = exports.postgresInit = exports.postgresPool = exports.pool = void 0;
const pg_1 = require("pg");
const env_init_1 = require("./env-init");
const defaultThreadPoolSize = 4;
function postgresPool() {
return {
user: env_init_1.env.databaseUser,
password: env_init_1.env.databasePassword,
host: env_init_1.env.databaseHost,
port: env_init_1.env.databasePort,
database: env_init_1.env.databaseName,
ssl: env_init_1.env.databaseSsl,
min: env_init_1.env.databasePoolMin,
max: env_init_1.env.databasePoolMax,
idleTimeoutMillis: env_init_1.env.databaseIdleTimeout,
connectionTimeoutMillis: env_init_1.env.databaseConnectionTimeout,
};
}
exports.postgresPool = postgresPool;
process.env.UV_THREADPOOL_SIZE = String((postgresPool().max || 0) + defaultThreadPoolSize);
async function postgresInit() {
exports.pool = new pg_1.Pool(postgresPool());
return exports.pool;
}
exports.postgresInit = postgresInit;
async function postgresClose() {
return exports.pool.end();
}
exports.postgresClose = postgresClose;
//# sourceMappingURL=postgres-config.js.map