add again

This commit is contained in:
Barış Soner Uşaklı
2023-06-15 19:33:41 -04:00
parent a7375a85ba
commit 9198a95173
8 changed files with 382 additions and 37 deletions

View File

@@ -59,8 +59,8 @@ mongoModule.questions = [
},
];
mongoModule.init = async function () {
client = await connection.connect(nconf.get('mongo'));
mongoModule.init = async function (opts) {
client = await connection.connect(opts || nconf.get('mongo'));
mongoModule.client = client.db();
};
@@ -175,6 +175,9 @@ async function getCollectionStats(db) {
mongoModule.close = async function () {
await client.close();
if (mongoModule.objectCache) {
mongoModule.objectCache.reset();
}
};
require('./mongo/main')(mongoModule);

View File

@@ -45,9 +45,9 @@ postgresModule.questions = [
},
];
postgresModule.init = async function () {
postgresModule.init = async function (opts) {
const { Pool } = require('pg');
const connOptions = connection.getConnectionOptions();
const connOptions = connection.getConnectionOptions(opts);
const pool = new Pool(connOptions);
postgresModule.pool = pool;
postgresModule.client = pool;

View File

@@ -33,8 +33,8 @@ redisModule.questions = [
];
redisModule.init = async function () {
redisModule.client = await connection.connect(nconf.get('redis'));
redisModule.init = async function (opts) {
redisModule.client = await connection.connect(opts || nconf.get('redis'));
};
redisModule.createSessionStore = async function (options) {
@@ -62,6 +62,9 @@ redisModule.checkCompatibilityVersion = function (version, callback) {
redisModule.close = async function () {
await redisModule.client.quit();
if (redisModule.objectCache) {
redisModule.objectCache.reset();
}
};
redisModule.info = async function (cxn) {