reload app locals on config change

merge-requests/218/head
Thomas Lynch 3 years ago
parent de75523ddc
commit e9ca4d7e21
  1. 5
      server.js

@ -60,10 +60,12 @@ const getConfig = require(__dirname+'/getconfig.js')
app.set('views', views);
const loadAppLocals = () => {
console.log('loadapplocals')
const { cacheTemplates, boardDefaults, globalLimits, captchaOptions,
enableUserBoardCreation, enableUserAccountCreation, cookieSecret,
debugLogs, ipHashPermLevel, meta, enableWebring } = getConfig();
//cache loaded templates
app.cache = {};
app[cacheTemplates === true ? 'enable' : 'disable']('view cache');
//default settings
app.locals.enableUserAccountCreation = enableUserAccountCreation;
@ -91,7 +93,8 @@ const getConfig = require(__dirname+'/getconfig.js')
break;
}
}
loadAppLocals(); //todo: make this repeat on config changes
loadAppLocals();
addCallback('config', loadAppLocals);
// routes
if (!production) {

Loading…
Cancel
Save