From dec1f3c4892c730e9f840c35bfc3504738ef2ada Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Wed, 21 Jul 2021 12:59:17 +0200 Subject: [PATCH] Allow passing absolute path to configfile --- meshcentral.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/meshcentral.js b/meshcentral.js index 94ecba4d..413088fc 100644 --- a/meshcentral.js +++ b/meshcentral.js @@ -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; }