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