forked from embee/woomy
		
	replace missing config values from config template
This commit is contained in:
		
							parent
							
								
									ecb9004ec8
								
							
						
					
					
						commit
						a048d94cd0
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		
							
								
								
									
										10
									
								
								index.js
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								index.js
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -21,12 +21,22 @@ const sentry = require('@sentry/node')
 | 
			
		|||
const client = new Discord.Client({ disabledEvents: ['TYPING_START'] })
 | 
			
		||||
 | 
			
		||||
// Load all our useful utilities
 | 
			
		||||
client.configTemplate = require('./configTemplate')
 | 
			
		||||
client.config = require('./config')
 | 
			
		||||
client.version = require('./version.json')
 | 
			
		||||
client.db = require('./utils/mongoose')
 | 
			
		||||
client.logger = require('./utils/logger')
 | 
			
		||||
require('./utils/_functions')(client)
 | 
			
		||||
 | 
			
		||||
// Set missing values in config from config template
 | 
			
		||||
for(let c in client.configTemplate) {
 | 
			
		||||
  if(typeof client.config[c] == 'undefined') {
 | 
			
		||||
    client.logger.warn('Config value missing: ' + String(c))
 | 
			
		||||
 | 
			
		||||
    client.config[c] = client.configTemplate[c]
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if (typeof client.config.devmode !== 'undefined') { // Check if devmode is explicitly overridden
 | 
			
		||||
  client.devmode = client.config.devmode
 | 
			
		||||
} else { // Check if Woomy is running inside a Docker
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue