diff --git a/README.md b/README.md index e78a872..baa796a 100644 --- a/README.md +++ b/README.md @@ -80,6 +80,14 @@ Options: При первом запуске в рабочей директории будет создан конфигурационный файл `config.json`: ```js { + // директория библиотеки (с zip-архивами), аналог параметра командной строки --lib-dir + // пустая строка: использовать значение по умолчанию - директорию файла приложения + "libDir": "", + + // путь к файлу .inpx, аналог параметра командной строки --inpx + // пустая строка: использовать значение по умолчанию - inpx-файл, что найдется в директории библиотеки + "inpx": "", + // пароль для ограничения доступа к веб-интерфейсу сервера // пустое значение - доступ без ограничений "accessPassword": "", diff --git a/server/config/base.js b/server/config/base.js index 591f0a8..9fa04a0 100644 --- a/server/config/base.js +++ b/server/config/base.js @@ -9,6 +9,8 @@ module.exports = { name: pckg.name, execDir, + libDir: '', + inpx: '', accessPassword: '', accessTimeout: 0, diff --git a/server/config/index.js b/server/config/index.js index edd1375..c8dfe9d 100644 --- a/server/config/index.js +++ b/server/config/index.js @@ -5,6 +5,8 @@ const fs = require('fs-extra'); const branchFilename = __dirname + '/application_env'; const propsToSave = [ + 'libDir', + 'inpx', 'accessPassword', 'accessTimeout', 'extendedSearch', diff --git a/server/index.js b/server/index.js index dcf5617..a93a85e 100644 --- a/server/index.js +++ b/server/index.js @@ -84,7 +84,7 @@ async function init() { } if (!config.remoteLib) { - const libDir = argv['lib-dir']; + const libDir = argv['lib-dir'] || config.libDir; if (libDir) { if (await fs.pathExists(libDir)) { config.libDir = libDir; @@ -95,11 +95,12 @@ async function init() { config.libDir = config.execDir; } - if (argv.inpx) { - if (await fs.pathExists(argv.inpx)) { - config.inpxFile = argv.inpx; + const inpxFile = argv.inpx || config.inpx; + if (inpxFile) { + if (await fs.pathExists(inpxFile)) { + config.inpxFile = inpxFile; } else { - throw new Error(`File "${argv.inpx}" not found`); + throw new Error(`File "${inpxFile}" not found`); } } else { const inpxFiles = [];