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