Merge branch '280-config-revamp' of github.com:NuSkooler/enigma-bbs into 280-config-revamp
This commit is contained in:
commit
c7c18eb0bd
14
core/bbs.js
14
core/bbs.js
|
@ -54,6 +54,8 @@ function printVersionAndExit() {
|
|||
}
|
||||
|
||||
function main() {
|
||||
let errorDisplayed = false;
|
||||
|
||||
async.waterfall(
|
||||
[
|
||||
function processArgs(callback) {
|
||||
|
@ -87,7 +89,14 @@ function main() {
|
|||
configPathSupplied = null; // make non-fatal; we'll go with defaults
|
||||
}
|
||||
} else {
|
||||
console.error(err.message);
|
||||
errorDisplayed = true;
|
||||
console.error(`Configuration error: ${err.message}`); // eslint-disable-line no-console
|
||||
if (err.hint) {
|
||||
console.error(`Hint: ${err.hint}`);
|
||||
}
|
||||
if (err.configPath) {
|
||||
console.error(`Note: ${err.configPath}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
return callback(err);
|
||||
|
@ -114,8 +123,9 @@ function main() {
|
|||
});
|
||||
}
|
||||
|
||||
if(err) {
|
||||
if(err && !errorDisplayed) {
|
||||
console.error('Error initializing: ' + util.inspect(err));
|
||||
return process.exit();
|
||||
}
|
||||
}
|
||||
);
|
||||
|
|
|
@ -53,7 +53,6 @@ exports.Config = class Config extends ConfigLoader {
|
|||
systemConfigInstance = new Config(configOptions);
|
||||
systemConfigInstance.init(baseConfigPath, err => {
|
||||
if (err) {
|
||||
console.stdout(`Configuration ${baseConfigPath} error: ${err.message}`); // eslint-disable-line no-console
|
||||
return cb(err);
|
||||
}
|
||||
|
||||
|
@ -61,7 +60,7 @@ exports.Config = class Config extends ConfigLoader {
|
|||
// instance we just created
|
||||
exports.get = systemConfigInstance.get.bind(systemConfigInstance);
|
||||
|
||||
return cb(err);
|
||||
return cb(null);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -185,6 +185,9 @@ module.exports = class ConfigLoader {
|
|||
};
|
||||
|
||||
ConfigCache.getConfigWithOptions(options, (err, config) => {
|
||||
if (err) {
|
||||
err.configPath = options.filePath;
|
||||
}
|
||||
return cb(err, config);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -265,6 +265,10 @@ exports.ThemeManager = class ThemeManager {
|
|||
};
|
||||
|
||||
[ 'menus', 'prompts'].forEach(sectionName => {
|
||||
if (!_.isObject(mergedTheme.sectionName)) {
|
||||
return Log.error({sectionName}, 'Merged theme is missing section');
|
||||
}
|
||||
|
||||
Object.keys(mergedTheme[sectionName]).forEach(entryName => {
|
||||
let createdFormSection = false;
|
||||
const mergedThemeMenu = mergedTheme[sectionName][entryName];
|
||||
|
|
Loading…
Reference in New Issue