From d561a48229c37e34ae2f50978a415f77e3cd97af Mon Sep 17 00:00:00 2001 From: Quietus <2498842+Quietus@users.noreply.github.com> Date: Thu, 17 Mar 2022 11:06:52 +0000 Subject: [PATCH] Allowed the configuration of a "HOST" parameter to enable ipv6 support. --- prod.js | 3 ++- server/Server.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/prod.js b/prod.js index 36339fb0..b6b0951b 100644 --- a/prod.js +++ b/prod.js @@ -21,6 +21,7 @@ var inputAudiobook = options.audiobooks ? Path.resolve(options.audiobooks) : nul var inputMetadata = options.metadata ? Path.resolve(options.metadata) : null const PORT = options.port || process.env.PORT || 3333 +const HOST = options.host || process.env.HOST || "0.0.0.0" const CONFIG_PATH = inputConfig || process.env.CONFIG_PATH || Path.resolve('config') const AUDIOBOOK_PATH = inputAudiobook || process.env.AUDIOBOOK_PATH || Path.resolve('audiobooks') const METADATA_PATH = inputMetadata || process.env.METADATA_PATH || Path.resolve('metadata') @@ -29,5 +30,5 @@ const GID = 100 console.log(process.env.NODE_ENV, 'Config', CONFIG_PATH, METADATA_PATH, AUDIOBOOK_PATH) -const Server = new server(PORT, UID, GID, CONFIG_PATH, METADATA_PATH, AUDIOBOOK_PATH) +const Server = new server(PORT, HOST, UID, GID, CONFIG_PATH, METADATA_PATH, AUDIOBOOK_PATH) Server.start() diff --git a/server/Server.js b/server/Server.js index a58a8851..890181aa 100644 --- a/server/Server.js +++ b/server/Server.js @@ -31,9 +31,9 @@ const CoverController = require('./CoverController') const CacheManager = require('./CacheManager') class Server { - constructor(PORT, UID, GID, CONFIG_PATH, METADATA_PATH, AUDIOBOOK_PATH) { + constructor(PORT, HOST, UID, GID, CONFIG_PATH, METADATA_PATH, AUDIOBOOK_PATH) { this.Port = PORT - this.Host = '0.0.0.0' + this.Host = HOST global.Uid = isNaN(UID) ? 0 : Number(UID) global.Gid = isNaN(GID) ? 0 : Number(GID) global.ConfigPath = Path.normalize(CONFIG_PATH) @@ -658,4 +658,4 @@ class Server { }) } } -module.exports = Server \ No newline at end of file +module.exports = Server