Read nolog file on startup

This commit is contained in:
MrFry 2019-11-10 09:12:49 +01:00
parent ef827ee7b4
commit 7b9a0af287

View file

@ -36,6 +36,7 @@ const logFile = '/nlogs/nlogs'
const allLogFile = '/nlogs/log'
const statFile = 'stats/stats'
const vStatFile = 'stats/vstats'
const nologFile = './nolog'
const writeInterval = 10
@ -112,14 +113,20 @@ function LogReq (req, toFile, sc) {
}
}
function parseNoLogFile (newData) {
noLogips = newData.split('\n')
if (noLogips[noLogips.length - 1] === '') {
noLogips.pop()
}
Log('\tNo Log IP-s changed: ' + noLogips.join(', '))
}
function setNoLogReadInterval () {
utils.WatchFile('./nolog', (newData) => {
noLogips = newData.split('\n')
if (noLogips[noLogips.length - 1] === '') {
noLogips.pop()
}
Log('\tNo Log IP-s changed: ' + noLogips.join(', '))
utils.WatchFile(nologFile, (newData) => {
parseNoLogFile(newData)
})
parseNoLogFile(utils.ReadFile(nologFile))
}
function Load () {