Allow passing absolute path to configfile
Linus Heckemann committed
Jul 21, 2021 at 12:59 UTC
dec1f3c4892c730e9f840c35bfc3504738ef2ada
1 file changed
+3
-1
meshcentral.js
+3
-1
@@ -3019,7 +3019,9 @@ function getConfig(createSampleConfig) {
3019
3020
// Read configuration file if present and change arguments.
3021
var config = {}, configFilePath = path.join(datapath, 'config.json');
3022
- if (args.configfile) { configFilePath = path.join(datapath, args.configfile); }
3022
+ if (args.configfile) {
3023
+ configFilePath = path.isAbsolute(args.configfile) ? args.configfile : path.join(datapath, args.configfile);
3024
+ }
3025
if (fs.existsSync(configFilePath)) {
3026
// Load and validate the configuration file
3027
try { config = require(configFilePath); } catch (e) { console.log('ERROR: Unable to parse ' + configFilePath + '.'); return null; }