logging & missing func & allow respawning on crash

This commit is contained in:
Erik 2023-03-22 00:39:15 +02:00
parent bf6acbbadf
commit 466544b8ed
Signed by: Navy.gif
GPG Key ID: 2532FBBB61C65A68
3 changed files with 5 additions and 8 deletions

View File

@ -1,7 +1,7 @@
{ {
"serverFilePath": "./src/server/Server.js", "serverFilePath": "./src/server/Server.js",
"shardOptions": { "shardOptions": {
"respawn": false "respawn": true
}, },
"shardCount": 1, "shardCount": 1,
"serverOptions": { "serverOptions": {

View File

@ -201,7 +201,7 @@ class Server extends EventEmitter {
#logRequest (req, res, next) { #logRequest (req, res, next) {
res.once('finish', () => { res.once('finish', () => {
this.logger[[ 401, 403 ].includes(res.statusCode) ? 'unauthorised' : 'access'](`[${req.get('X-Forwarded-For') || req.socket.remoteAddress}] [STATUS: ${res.statusCode}] Request to [${req.method}] ${req.route?.path || req.path}`); this.logger[[ 401, 403 ].includes(res.statusCode) ? 'unauthorised' : 'access'](`[${req.get('X-Forwarded-For') || req.socket.remoteAddress}] [STATUS: ${res.statusCode}] ${req.user ? `${req.user.name} (${req.user.id})` : '-'} Request to [${req.method}] ${req.route?.path || req.path}`);
}); });
next(); next();
} }

View File

@ -59,12 +59,9 @@ class User extends AbstractUser {
return Object.freeze({ ...this.#_externalProfiles }); return Object.freeze({ ...this.#_externalProfiles });
} }
// async fetchApplications () { async fetchApplications () {
// const apps = await Promise.all(this._applications.map(id => this._db.fetchApplication(id))); return Promise.all(this.#_applications.map(id => this._db.fetchApplication(id)));
// for (const app of apps) }
// this.applications[app.id] = app;
// return this.applications;
// }
async createApplication (name, { description } = {}, saveFn) { async createApplication (name, { description } = {}, saveFn) {
if (typeof saveFn !== 'function') if (typeof saveFn !== 'function')