Compare commits
No commits in common. "29c8c7cab8db6d773ec0f01047645976722eb55d" and "d65a8d78742e7ebf3799562f38e0297ffee7cfc3" have entirely different histories.
29c8c7cab8
...
d65a8d7874
@ -9,7 +9,6 @@ import express, { Express, NextFunction } from 'express';
|
|||||||
import helmet from 'helmet';
|
import helmet from 'helmet';
|
||||||
import cors from 'cors';
|
import cors from 'cors';
|
||||||
import MongoStore from 'connect-mongo';
|
import MongoStore from 'connect-mongo';
|
||||||
import { Collection } from '@discordjs/collection';
|
|
||||||
|
|
||||||
// Own
|
// Own
|
||||||
import { LogFunction, LoggerClient } from '@navy.gif/logger';
|
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 { IPCMessage, SignupCode } from '../../@types/Other.js';
|
||||||
import { DoneCallback } from 'passport';
|
import { DoneCallback } from 'passport';
|
||||||
import FlagManager from './components/FlagManager.js';
|
import FlagManager from './components/FlagManager.js';
|
||||||
|
import { Collection } from '@discordjs/collection';
|
||||||
|
|
||||||
// const pkg = JSON.parse(readFileSync('../../package.json', { encoding: 'utf8' }));
|
// const pkg = JSON.parse(readFileSync('../../package.json', { encoding: 'utf8' }));
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ class Server extends EventEmitter
|
|||||||
#server: http.Server | null;
|
#server: http.Server | null;
|
||||||
#app: Express;
|
#app: Express;
|
||||||
|
|
||||||
#mariadb?: MariaDB;
|
#mariadb: MariaDB;
|
||||||
#mongodb: MongoDB;
|
#mongodb: MongoDB;
|
||||||
#memoryStoreProvider: MongoMemory;
|
#memoryStoreProvider: MongoMemory;
|
||||||
#userDatabase: UserDatabaseInterface;
|
#userDatabase: UserDatabaseInterface;
|
||||||
@ -137,19 +137,16 @@ class Server extends EventEmitter
|
|||||||
|
|
||||||
// TODO: Database definitions should probably be elsewhere through injection
|
// TODO: Database definitions should probably be elsewhere through injection
|
||||||
// Mariadb isn't strictly necessary here for anything, it's just here pre-emptively
|
// 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,
|
||||||
this.#mariadb = new MariaDB(this, {
|
credentials: {
|
||||||
...databases.mariadb,
|
host: MARIA_HOST,
|
||||||
credentials: {
|
user: MARIA_USER,
|
||||||
host: MARIA_HOST,
|
port: parseInt(MARIA_PORT),
|
||||||
user: MARIA_USER,
|
password: MARIA_PASS,
|
||||||
port: parseInt(MARIA_PORT),
|
database: MARIA_DB
|
||||||
password: MARIA_PASS,
|
}
|
||||||
database: MARIA_DB
|
});
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// Mongo is used for session and user storage
|
// Mongo is used for session and user storage
|
||||||
this.#mongodb = new MongoDB(this, {
|
this.#mongodb = new MongoDB(this, {
|
||||||
...databases.mongodb,
|
...databases.mongodb,
|
||||||
@ -246,11 +243,8 @@ class Server extends EventEmitter
|
|||||||
const start = Date.now();
|
const start = Date.now();
|
||||||
this.#logger.status('Starting server');
|
this.#logger.status('Starting server');
|
||||||
|
|
||||||
if (this.#mariadb)
|
this.#logger.info('Initialising MariaDB');
|
||||||
{
|
this.#mariadb.init();
|
||||||
this.#logger.info('Initialising MariaDB');
|
|
||||||
this.#mariadb.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.#logger.info('Initialising MongoDB');
|
this.#logger.info('Initialising MongoDB');
|
||||||
await this.#mongodb.init();
|
await this.#mongodb.init();
|
||||||
@ -366,7 +360,7 @@ class Server extends EventEmitter
|
|||||||
this.#server.close(async () =>
|
this.#server.close(async () =>
|
||||||
{
|
{
|
||||||
await this.#mongodb.close();
|
await this.#mongodb.close();
|
||||||
await this.#mariadb?.close();
|
await this.#mariadb.close();
|
||||||
await this.#memoryStoreProvider.close();
|
await this.#memoryStoreProvider.close();
|
||||||
await this.#messageBroker?.close();
|
await this.#messageBroker?.close();
|
||||||
this.#logger.status('DB shutdowns complete.');
|
this.#logger.status('DB shutdowns complete.');
|
||||||
|
Loading…
Reference in New Issue
Block a user