comments + alias

This commit is contained in:
Erik 2022-11-21 12:49:14 +02:00
parent 1218512972
commit 74ea4d73d6
Signed by: Navy.gif
GPG Key ID: 811EC0CD80E7E5FB

View File

@ -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: {