mirror of
				https://github.com/Ylianst/MeshCentral.git
				synced 2025-03-09 15:40:18 +00:00 
			
		
		
		
	Allow passing absolute path to configfile
This commit is contained in:
		
							parent
							
								
									56dae7fac5
								
							
						
					
					
						commit
						dec1f3c489
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -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; }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue