replace missing config values from config template

This commit is contained in:
Lukáš H 2020-04-22 18:00:52 +02:00
parent ecb9004ec8
commit a048d94cd0
No known key found for this signature in database
GPG key ID: E07D6630DBC17195

View file

@ -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