bugfix, warn when no domain set in prod env

This commit is contained in:
Erik 2023-02-08 00:01:36 +02:00
parent 28cf479e4b
commit dd00b85dfc
Signed by: Navy.gif
GPG Key ID: 2532FBBB61C65A68
2 changed files with 9 additions and 2 deletions

View File

@ -56,7 +56,14 @@ class Server extends EventEmitter {
// Port number is automatically incremented based on shard # // Port number is automatically incremented based on shard #
this.port = httpOpts.port + this._shardId; this.port = httpOpts.port + this._shardId;
// Primarily used by the OAuth methods for the callback url // 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 this.serveFiles = null; // Holds a reference to the directory from which to serve content
if (options.serveFiles) if (options.serveFiles)
this.serveFiles = path.resolve(options.serveFiles); this.serveFiles = path.resolve(options.serveFiles);

View File

@ -102,7 +102,7 @@ class UserDatabase extends AbstractUserDatabase {
if (!username) if (!username)
throw new Error('Missing 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) if (user)
return Promise.resolve(user); return Promise.resolve(user);