From e36c31c5e77ec51422054d42186ede85d1a03271 Mon Sep 17 00:00:00 2001 From: advplyr Date: Thu, 17 Mar 2022 08:18:39 -0500 Subject: [PATCH] Add HOST config for docker and debian --- build/debian/DEBIAN/preinst | 7 +++++-- index.js | 3 ++- prod.js | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/build/debian/DEBIAN/preinst b/build/debian/DEBIAN/preinst index 81203bec..02104133 100644 --- a/build/debian/DEBIAN/preinst +++ b/build/debian/DEBIAN/preinst @@ -6,6 +6,7 @@ FFMPEG_INSTALL_DIR="/usr/lib/audiobookshelf-ffmpeg/" DEFAULT_AUDIOBOOK_PATH="/usr/share/audiobookshelf/audiobooks" DEFAULT_DATA_PATH="/usr/share/audiobookshelf" DEFAULT_PORT=7331 +DEFAULT_HOST="0.0.0.0" CONFIG_PATH="/etc/default/audiobookshelf" @@ -82,7 +83,8 @@ setup_config_interactive() { CONFIG_PATH=$DATA_PATH/config FFMPEG_PATH=/usr/lib/audiobookshelf-ffmpeg/ffmpeg FFPROBE_PATH=/usr/lib/audiobookshelf-ffmpeg/ffprobe - PORT=$PORT" + PORT=$PORT + HOST=$DEFAULT_HOST" echo "$config_text" @@ -105,7 +107,8 @@ setup_config() { CONFIG_PATH=$DEFAULT_DATA_PATH/config FFMPEG_PATH=/usr/lib/audiobookshelf-ffmpeg/ffmpeg FFPROBE_PATH=/usr/lib/audiobookshelf-ffmpeg/ffprobe - PORT=$DEFAULT_PORT" + PORT=$DEFAULT_PORT + HOST=$DEFAULT_HOST" echo "$config_text" diff --git a/index.js b/index.js index f6c26bba..a5b7b446 100644 --- a/index.js +++ b/index.js @@ -16,6 +16,7 @@ if (isDev) { } const PORT = process.env.PORT || 80 +const HOST = process.env.HOST || '0.0.0.0' const CONFIG_PATH = process.env.CONFIG_PATH || '/config' const AUDIOBOOK_PATH = process.env.AUDIOBOOK_PATH || '/audiobooks' const METADATA_PATH = process.env.METADATA_PATH || '/metadata' @@ -24,5 +25,5 @@ const GID = process.env.AUDIOBOOKSHELF_GID || 100 console.log('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/prod.js b/prod.js index b6b0951b..4e67aa49 100644 --- a/prod.js +++ b/prod.js @@ -2,7 +2,8 @@ const optionDefinitions = [ { name: 'config', alias: 'c', type: String }, { name: 'audiobooks', alias: 'a', type: String }, { name: 'metadata', alias: 'm', type: String }, - { name: 'port', alias: 'p', type: String } + { name: 'port', alias: 'p', type: String }, + { name: 'host', alias: 'h', type: String } ] const commandLineArgs = require('command-line-args')