Changed short variable names to something longer

This commit is contained in:
mrfry 2020-11-09 18:00:07 +01:00
parent ffdb2c6db6
commit bde4580806

View file

@ -66,7 +66,7 @@ try {
} }
} catch (err) { } catch (err) {
logger.Log('Failed to read extra modules file') logger.Log('Failed to read extra modules file')
console.log(err) console.error(err)
} }
// Setting up exits // Setting up exits
@ -77,17 +77,17 @@ process.on('SIGTERM', () => exit('SIGTERM'))
function exit(reason) { function exit(reason) {
console.log() console.log()
logger.Log(`Exiting, reason: ${reason}`) logger.Log(`Exiting, reason: ${reason}`)
Object.keys(modules).forEach((k, i) => { Object.keys(modules).forEach((key) => {
const x = modules[k] const module = modules[key]
if (x.cleanup) { if (module.cleanup) {
try { try {
x.cleanup() module.cleanup()
} catch (e) { } catch (err) {
logger.Log( logger.Log(
`Error in ${k} cleanup! Details in STDERR`, `Error in ${key} cleanup! Details in STDERR`,
logger.GetColor('redbg') logger.GetColor('redbg')
) )
console.error(e) console.error(err)
} }
} }
}) })
@ -137,35 +137,35 @@ app.use(
}) })
) )
Object.keys(modules).forEach(function(k, i) { Object.keys(modules).forEach(function(key) {
let x = modules[k] let module = modules[key]
try { try {
let mod = require(x.path) let mod = require(module.path)
logger.Log(`Loading ${mod.name} module`, logger.GetColor('yellow')) logger.Log(`Loading ${mod.name} module`, logger.GetColor('yellow'))
x.publicdirs.forEach((pdir) => { module.publicdirs.forEach((pdir) => {
utils.CreatePath(pdir) utils.CreatePath(pdir)
}) })
if (mod.setup) { if (mod.setup) {
mod.setup({ mod.setup({
url: 'https://' + x.urls[0], url: 'https://' + module.urls[0],
userDB: userDB, userDB: userDB,
publicdirs: x.publicdirs, publicdirs: module.publicdirs,
nextdir: x.nextdir, nextdir: module.nextdir,
}) })
} }
const modApp = mod.getApp() const modApp = mod.getApp()
x.app = modApp.app module.app = modApp.app
x.dailyAction = modApp.dailyAction module.dailyAction = modApp.dailyAction
x.cleanup = modApp.cleanup module.cleanup = modApp.cleanup
x.urls.forEach((url) => { module.urls.forEach((url) => {
app.use(vhost(url, x.app)) app.use(vhost(url, module.app))
}) })
} catch (e) { } catch (err) {
console.log(e) console.error(err)
} }
}) })
@ -191,9 +191,9 @@ if (
ca: ca, ca: ca,
} }
certsLoaded = true certsLoaded = true
} catch (e) { } catch (err) {
logger.Log('Error loading cert files!', logger.GetColor('redbg')) logger.Log('Error loading cert files!', logger.GetColor('redbg'))
console.log(e) console.error(err)
} }
} }
@ -229,19 +229,19 @@ function setLogTimer() {
function LogTimerAction() { function LogTimerAction() {
logger.DebugLog(`Running Log Timer Action`, 'daily', 1) logger.DebugLog(`Running Log Timer Action`, 'daily', 1)
Object.keys(modules).forEach((k, i) => { Object.keys(modules).forEach((key) => {
const x = modules[k] const module = modules[key]
logger.DebugLog(`Ckecking ${k}`, 'daily', 1) logger.DebugLog(`Ckecking ${key}`, 'daily', 1)
if (x.dailyAction) { if (module.dailyAction) {
try { try {
logger.Log(`Running daily action of ${k}`) logger.Log(`Running daily action of ${key}`)
x.dailyAction() module.dailyAction()
} catch (e) { } catch (err) {
logger.Log( logger.Log(
`Error in ${k} daily action! Details in STDERR`, `Error in ${key} daily action! Details in STDERR`,
logger.GetColor('redbg') logger.GetColor('redbg')
) )
console.err(e) console.err(err)
} }
} }
}) })