From 74ea4d73d62f7891d655aded71c6a5452c7d2ef8 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Mon, 21 Nov 2022 12:49:14 +0200 Subject: [PATCH] comments + alias --- src/server/Server.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/server/Server.js b/src/server/Server.js index 6ffd2b0..ca5ba3a 100644 --- a/src/server/Server.js +++ b/src/server/Server.js @@ -48,11 +48,13 @@ class Server extends EventEmitter { this._proto = NODE_ENV === 'development' ? 'http' : 'https'; if (!httpOpts?.port) return Util.fatal(new Error(`Missing http.port in server options`)); - this.port = httpOpts.port + this._shardId; + // Port number is automatically incremented based on shard # + this.port = httpOpts.port + this._shardId; + // Primarily used by the OAuth methods for the callback url this.domain = NODE_ENV === 'development' ? `localhost:${this.port}` : options.domain; - this.serveFiles = null; - this.registrationEnabled = options.registrationEnabled; + this.serveFiles = null; // Holds a reference to the directory from which to serve content if (options.serveFiles) this.serveFiles = path.resolve(options.serveFiles); + this.registrationEnabled = options.registrationEnabled; this.server = null; this.app = express(); @@ -61,11 +63,14 @@ class Server extends EventEmitter { this.registry = new Registry(this, { path: path.join(__dirname, 'endpoints') }); this.logger = new LoggerClient({ ...options.logger, name: this.constructor.name }); - // Mariadb isn't strictly necessart here for anything, it's just here pre-emptively + // Mariadb isn't strictly necessary here for anything, it's just here pre-emptively this.mariadb = new MariaDB(this, { options: databases.mariadb, MARIA_HOST, MARIA_USER, MARIA_PORT, MARIA_PASS, MARIA_DB }); // Mongo is used for session and user storage this.mongodb = new MongoDB(this, { options: databases.mongodb, MONGO_HOST, MONGO_USER, MONGO_PORT, MONGO_PASS, MONGO_DB }); this.userDatabase = new UserDatabase(this, this.mongodb, { validUserTypes }); + // Alias + this.users = this.userDatabase; + // Authenticator takes care of sessions, logins and authorisations this.authenticator = new Authenticator(this, this.userDatabase, { mongo: this.mongodb, @@ -92,7 +97,7 @@ class Server extends EventEmitter { 'style-src': [ "'self'", "'unsafe-inline'" ], 'img-src': [ "'self'", "https:" ], 'media-src': [ "'self'" ], - 'frame-src': [ "youtube.com", "www.youtube.com" ] + 'frame-src': [ "'self'" ] } }, crossOriginResourcePolicy: {