Merge pull request #2928 from mayflower/absolute-config-path

Allow passing absolute path to configfile
This commit is contained in:
Ylian Saint-Hilaire 2021-07-21 09:03:38 -07:00 committed by GitHub
commit 28ab9f69e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3019,7 +3019,9 @@ function getConfig(createSampleConfig) {
// Read configuration file if present and change arguments.
var config = {}, configFilePath = path.join(datapath, 'config.json');
if (args.configfile) { configFilePath = path.join(datapath, args.configfile); }
if (args.configfile) {
configFilePath = path.isAbsolute(args.configfile) ? args.configfile : path.join(datapath, args.configfile);
}
if (fs.existsSync(configFilePath)) {
// Load and validate the configuration file
try { config = require(configFilePath); } catch (e) { console.log('ERROR: Unable to parse ' + configFilePath + '.'); return null; }