Meshctrl.js improvement to find config.json
Ylian Saint-Hilaire committed
Jun 12, 2020 at 12:39 UTC
442a3029a3ae6baeab6236b1e4ac51eb4e2f35d4
1 file changed
+2
-1
meshctrl.js
+2
-1
@@ -445,9 +445,10 @@ function performConfigOperations(args) {
445
var configChange = false;
446
var fs = require('fs');
447
var path = require('path');
448
- var configFile = path.join(__dirname, 'config.json');
448
+ var configFile = 'config.json';
449
var didSomething = 0;
450
if (fs.existsSync(configFile) == false) { configFile = path.join('meshcentral-data', 'config.json'); }
451
+ if (fs.existsSync(configFile) == false) { configFile = path.join(__dirname, 'config.json'); }
452
if (fs.existsSync(configFile) == false) { configFile = path.join(__dirname, 'meshcentral-data', 'config.json'); }
453
if (fs.existsSync(configFile) == false) { configFile = path.join(__dirname, '..', 'meshcentral-data', 'config.json'); }
454
if (fs.existsSync(configFile) == false) { console.log("Unable to find config.json."); return; }