Passing servers to modules, minor code refactor

This commit is contained in:
mrfry 2021-05-26 18:38:02 +02:00
parent 314914e898
commit a12aadf32d
5 changed files with 68 additions and 53 deletions

View file

@ -40,6 +40,8 @@ const moduleName = 'API'
let userDB
let url
let publicdirs = []
let httpServer
let httpsServer
function GetApp(): ModuleType {
const app = express()
@ -203,6 +205,8 @@ function setupSubModules(
url: url,
publicdirs: publicdirs,
moduleSpecificData: moduleSpecificData,
httpServer: httpServer,
httpsServer: httpsServer,
})
moduleDatas.push(loadedModData || {})
} catch (e) {
@ -219,7 +223,9 @@ export default {
getApp: GetApp,
setup: (data: SetupData): void => {
userDB = data.userDB
url = data.url // eslint-disable-line
url = data.url
publicdirs = data.publicdirs
httpServer = data.httpServer
httpsServer = data.httpsServer
},
}