From 3563eeaf2344000996afc516f30b4918c32de4b8 Mon Sep 17 00:00:00 2001 From: "Navy.gif" Date: Wed, 9 Nov 2022 16:50:43 +0200 Subject: [PATCH] localhost for domain in development --- src/server/Server.js | 5 ++--- src/server/interfaces/Endpoint.js | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/server/Server.js b/src/server/Server.js index 4d7e7c5..69f3da7 100644 --- a/src/server/Server.js +++ b/src/server/Server.js @@ -2,7 +2,7 @@ const { EventEmitter } = require('node:events'); // const { inspect } = require('node:util'); const path = require('node:path'); -const http = require('node:http2'); +const http = require('node:http'); // External const { LoggerClient } = require('@navy.gif/logger'); @@ -41,8 +41,7 @@ class Server extends EventEmitter { if (!httpOpts?.port) return Util.fatal(new Error(`Missing http.port in server options`)); this.port = httpOpts.port + this._shardId; - this.domain = options.domain; - + this.domain = NODE_ENV === 'development' ? `localhost:${this.port}` : options.domain; this.server = null; this.app = express(); diff --git a/src/server/interfaces/Endpoint.js b/src/server/interfaces/Endpoint.js index 731222a..33ca5a5 100644 --- a/src/server/interfaces/Endpoint.js +++ b/src/server/interfaces/Endpoint.js @@ -15,7 +15,7 @@ class Endpoint { // Subpaths that should exist on *all* endpoints, the subpaths property can be overwritten, so storing these separately to ensure they exist this._subpaths = [ - '/debug', 'post', this.toggleDebug.bind(this), [ server.authenticator.createAuthoriser('developer') ] + [ '/debug', 'post', this.toggleDebug.bind(this), [ server.authenticator.createAuthoriser('developer') ]] ]; this.middleware = [];