Fix archive util config reload
This commit is contained in:
parent
469c08b0f2
commit
5bb4f9b903
|
@ -6,6 +6,7 @@ const Config = require('./config.js').get;
|
|||
const stringFormat = require('./string_format.js');
|
||||
const Errors = require('./enig_error.js').Errors;
|
||||
const resolveMimeType = require('./mime_util.js').resolveMimeType;
|
||||
const Events = require('./events.js');
|
||||
|
||||
// base/modules
|
||||
const fs = require('graceful-fs');
|
||||
|
@ -58,9 +59,13 @@ module.exports = class ArchiveUtil {
|
|||
}
|
||||
|
||||
init() {
|
||||
//
|
||||
// Load configuration
|
||||
//
|
||||
this.reloadConfig();
|
||||
Events.on(Events.getSystemEvents().ConfigChanged, () => {
|
||||
this.reloadConfig();
|
||||
});
|
||||
}
|
||||
|
||||
reloadConfig() {
|
||||
const config = Config();
|
||||
if(_.has(config, 'archives.archivers')) {
|
||||
Object.keys(config.archives.archivers).forEach(archKey => {
|
||||
|
|
|
@ -94,7 +94,12 @@ function init(configPath, options, cb) {
|
|||
const reCachedPath = paths.join(fileRoot, fileName);
|
||||
ConfigCache.getConfig(reCachedPath, (err, config) => {
|
||||
if(!err) {
|
||||
mergeValidateAndFinalize(config);
|
||||
mergeValidateAndFinalize(config, err => {
|
||||
if(!err) {
|
||||
const Events = require('./events.js');
|
||||
Events.emit(Events.getSystemEvents().ConfigChanged);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -6,10 +6,10 @@ module.exports = {
|
|||
ClientDisconnected : 'codes.l33t.enigma.system.disconnected', // { client, connectionCount }
|
||||
TermDetected : 'codes.l33t.enigma.system.term_detected', // { client }
|
||||
|
||||
ThemeChanged : 'codes.l33t.enigma.system.theme_changed', // { themeId }
|
||||
ConfigChanged : 'codes.l33t.enigma.system.config_changed',
|
||||
MenusChanged : 'codes.l33t.enigma.system.menus_changed',
|
||||
PromptsChanged : 'codes.l33t.enigma.system.prompts_changed',
|
||||
ThemeChanged : 'codes.l33t.enigma.system.theme_changed', // (theme.hjson): { themeId }
|
||||
ConfigChanged : 'codes.l33t.enigma.system.config_changed', // (config.hjson)
|
||||
MenusChanged : 'codes.l33t.enigma.system.menus_changed', // (menu.hjson)
|
||||
PromptsChanged : 'codes.l33t.enigma.system.prompts_changed', // (prompt.hjson)
|
||||
|
||||
// User - includes { user, ...}
|
||||
NewUser : 'codes.l33t.enigma.system.new_user',
|
||||
|
|
Loading…
Reference in New Issue