instantiate flagmanager

This commit is contained in:
Erik 2023-05-09 14:26:35 +03:00
parent 16016071a4
commit 48dbb5465b
Signed by: Navy.gif
GPG Key ID: 2532FBBB61C65A68

View File

@ -24,6 +24,7 @@ import { ExternalProfile, OAuthProvider, Request, Response, ServerOptions } from
import { MongoMemory } from './database/index.js'; 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';
// const pkg = JSON.parse(readFileSync('../../package.json', { encoding: 'utf8' })); // const pkg = JSON.parse(readFileSync('../../package.json', { encoding: 'utf8' }));
@ -36,8 +37,6 @@ import { DoneCallback } from 'passport';
class Server extends EventEmitter { class Server extends EventEmitter {
#_name: string; #_name: string;
#_userDatabase: UserDatabaseInterface;
#_messageBroker: MessageBroker;
#_options: ServerOptions; #_options: ServerOptions;
#_shardId: number; #_shardId: number;
#_ready: boolean; #_ready: boolean;
@ -48,15 +47,23 @@ class Server extends EventEmitter {
#_registrationEnabled: boolean; #_registrationEnabled: boolean;
#_requireCodeForRegister: boolean; #_requireCodeForRegister: boolean;
#_OAuthProviders: OAuthProvider[]; #_OAuthProviders: OAuthProvider[];
#_registry: Registry;
#_server: http.Server | null; #_server: http.Server | null;
#_app: Express; #_app: Express;
#_registry: Registry;
#_mariadb: MariaDB; #_mariadb: MariaDB;
#_mongodb: MongoDB; #_mongodb: MongoDB;
#_memoryStoreProvider: MongoMemory; #_memoryStoreProvider: MongoMemory;
#_userDatabase: UserDatabaseInterface;
#_messageBroker: MessageBroker;
#_rateLimiter: RateLimiter; #_rateLimiter: RateLimiter;
#_authenticator: Authenticator; #_authenticator: Authenticator;
#_flagManager: FlagManager;
#logger: LoggerClient; #logger: LoggerClient;
// eslint-disable-next-line max-lines-per-function // eslint-disable-next-line max-lines-per-function
@ -169,6 +176,7 @@ class Server extends EventEmitter {
}); });
this.#_rateLimiter = new RateLimiter(this, this.#_memoryStoreProvider); this.#_rateLimiter = new RateLimiter(this, this.#_memoryStoreProvider);
this.#_flagManager = new FlagManager(this);
// Authenticator takes care of sessions, logins and authorisations // Authenticator takes care of sessions, logins and authorisations
this.#_authenticator = new Authenticator(this, this.#_userDatabase, { this.#_authenticator = new Authenticator(this, this.#_userDatabase, {
@ -233,6 +241,8 @@ class Server extends EventEmitter {
await this.#_messageBroker.init(); await this.#_messageBroker.init();
await this.#_flagManager.init();
this.#logger.info('Loading endpoints'); this.#logger.info('Loading endpoints');
await this.#_registry.loadEndpoints(); await this.#_registry.loadEndpoints();
this.#logger.debug(this.#_registry.print); this.#logger.debug(this.#_registry.print);
@ -456,6 +466,10 @@ class Server extends EventEmitter {
return this.#_name; return this.#_name;
} }
get flagManager () {
return this.#_flagManager;
}
} }
process.once('message', (msg: IPCMessage) => { process.once('message', (msg: IPCMessage) => {