Compare commits

..

No commits in common. "29c8c7cab8db6d773ec0f01047645976722eb55d" and "d65a8d78742e7ebf3799562f38e0297ffee7cfc3" have entirely different histories.

View File

@ -9,7 +9,6 @@ import express, { Express, NextFunction } from 'express';
import helmet from 'helmet';
import cors from 'cors';
import MongoStore from 'connect-mongo';
import { Collection } from '@discordjs/collection';
// Own
import { LogFunction, LoggerClient } from '@navy.gif/logger';
@ -26,6 +25,7 @@ import { MongoMemory } from './database/index.js';
import { IPCMessage, SignupCode } from '../../@types/Other.js';
import { DoneCallback } from 'passport';
import FlagManager from './components/FlagManager.js';
import { Collection } from '@discordjs/collection';
// const pkg = JSON.parse(readFileSync('../../package.json', { encoding: 'utf8' }));
@ -57,7 +57,7 @@ class Server extends EventEmitter
#server: http.Server | null;
#app: Express;
#mariadb?: MariaDB;
#mariadb: MariaDB;
#mongodb: MongoDB;
#memoryStoreProvider: MongoMemory;
#userDatabase: UserDatabaseInterface;
@ -137,8 +137,6 @@ class Server extends EventEmitter
// TODO: Database definitions should probably be elsewhere through injection
// Mariadb isn't strictly necessary here for anything, it's just here pre-emptively
if (databases.mariadb?.load)
{
this.#mariadb = new MariaDB(this, {
...databases.mariadb,
credentials: {
@ -149,7 +147,6 @@ class Server extends EventEmitter
database: MARIA_DB
}
});
}
// Mongo is used for session and user storage
this.#mongodb = new MongoDB(this, {
...databases.mongodb,
@ -246,11 +243,8 @@ class Server extends EventEmitter
const start = Date.now();
this.#logger.status('Starting server');
if (this.#mariadb)
{
this.#logger.info('Initialising MariaDB');
this.#mariadb.init();
}
this.#logger.info('Initialising MongoDB');
await this.#mongodb.init();
@ -366,7 +360,7 @@ class Server extends EventEmitter
this.#server.close(async () =>
{
await this.#mongodb.close();
await this.#mariadb?.close();
await this.#mariadb.close();
await this.#memoryStoreProvider.close();
await this.#messageBroker?.close();
this.#logger.status('DB shutdowns complete.');