Merge pull request #1821 from thelounge/astorije/empty-conf-warning

Warn if user configuration being loaded is empty
This commit is contained in:
Pavel Djundik 2017-12-10 11:55:14 +02:00 committed by GitHub
commit ca22da28a7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -79,7 +79,14 @@ function setHome(newPath) {
// Reload config from new home location
if (fs.existsSync(configPath)) {
var userConfig = require(configPath);
const userConfig = require(configPath);
if (_.isEmpty(userConfig)) {
log.warn(`The file located at ${colors.green(configPath)} does not appear to expose anything.`);
log.warn(`Make sure it is non-empty and the configuration is exported using ${colors.bold("module.exports = { ... }")}.`);
log.warn("Using default configuration...");
}
this.config = _.merge(this.config, userConfig);
}