From dd00b85dfcda15c0cb36c8ed2fa022bc3023aa20 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 8 Feb 2023 00:01:36 +0200 Subject: [PATCH] bugfix, warn when no domain set in prod env --- src/server/Server.js | 9 ++++++++- src/server/components/UserDatabase.js | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/server/Server.js b/src/server/Server.js index 72c7952..6c78280 100644 --- a/src/server/Server.js +++ b/src/server/Server.js @@ -56,7 +56,14 @@ class Server extends EventEmitter { // 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; + if (NODE_ENV === 'development') { + this.domain = `localhost:${this.port}`; + } else { + if (!options.domain) + this.logger.warn('No domain provided in options.json:serverOptions'); + this.domain = options.domain; + } + this.serveFiles = null; // Holds a reference to the directory from which to serve content if (options.serveFiles) this.serveFiles = path.resolve(options.serveFiles); diff --git a/src/server/components/UserDatabase.js b/src/server/components/UserDatabase.js index f33a13e..0428809 100644 --- a/src/server/components/UserDatabase.js +++ b/src/server/components/UserDatabase.js @@ -102,7 +102,7 @@ class UserDatabase extends AbstractUserDatabase { if (!username) throw new Error('Missing username'); - let user = this.cache.find(u => u.username.toLowerCase() === username.toLowerCase()); + let user = this.cache.find(u => u.username?.toLowerCase() === username.toLowerCase()); if (user) return Promise.resolve(user);