mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
loading idstats and logger after validating files
This commit is contained in:
parent
532561e894
commit
496ae1c28f
2 changed files with 6 additions and 6 deletions
|
@ -41,7 +41,7 @@ import utils from './utils/utils'
|
||||||
import dbtools from './utils/dbtools'
|
import dbtools from './utils/dbtools'
|
||||||
import reqlogger from './middlewares/reqlogger.middleware'
|
import reqlogger from './middlewares/reqlogger.middleware'
|
||||||
import idStats from './utils/ids'
|
import idStats from './utils/ids'
|
||||||
import { paths, validateFiles } from './utils/files'
|
import { paths, validateAndSetupFiles } from './utils/files'
|
||||||
import constants from './constants'
|
import constants from './constants'
|
||||||
|
|
||||||
const logFile = paths.logDir + logger.logFileName
|
const logFile = paths.logDir + logger.logFileName
|
||||||
|
@ -63,9 +63,6 @@ function moveLogIfNotFromToday(path: string, to: string) {
|
||||||
moveLogIfNotFromToday(logFile, paths.logDir)
|
moveLogIfNotFromToday(logFile, paths.logDir)
|
||||||
moveLogIfNotFromToday(vlogFile, paths.vlogDir)
|
moveLogIfNotFromToday(vlogFile, paths.vlogDir)
|
||||||
|
|
||||||
idStats.Load()
|
|
||||||
logger.Load()
|
|
||||||
|
|
||||||
interface Modules {
|
interface Modules {
|
||||||
[name: string]: Module
|
[name: string]: Module
|
||||||
}
|
}
|
||||||
|
@ -91,7 +88,7 @@ export interface SetupData {
|
||||||
httpsServer: https.Server
|
httpsServer: https.Server
|
||||||
}
|
}
|
||||||
|
|
||||||
const filesValid = validateFiles()
|
const filesValid = validateAndSetupFiles()
|
||||||
if (!filesValid) {
|
if (!filesValid) {
|
||||||
const msg =
|
const msg =
|
||||||
'Not all files are valid which are needed to run the server! Please resolve the above issues, and start again.'
|
'Not all files are valid which are needed to run the server! Please resolve the above issues, and start again.'
|
||||||
|
@ -99,6 +96,9 @@ if (!filesValid) {
|
||||||
throw new Error(msg)
|
throw new Error(msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idStats.Load()
|
||||||
|
logger.Load()
|
||||||
|
|
||||||
const userDB = dbtools.GetDB(paths.usersDBPath)
|
const userDB = dbtools.GetDB(paths.usersDBPath)
|
||||||
let modules: Modules = utils.ReadJSON(paths.modulesFile)
|
let modules: Modules = utils.ReadJSON(paths.modulesFile)
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@ type FileDescriptor = {
|
||||||
warningIfMissing?: boolean
|
warningIfMissing?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export const validateFiles = (): boolean => {
|
export const validateAndSetupFiles = (): boolean => {
|
||||||
let everythingValid = true
|
let everythingValid = true
|
||||||
Object.entries(files).forEach(([key, file]: [string, FileDescriptor]) => {
|
Object.entries(files).forEach(([key, file]: [string, FileDescriptor]) => {
|
||||||
let fileExists = utils.FileExists(file.path)
|
let fileExists = utils.FileExists(file.path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue