mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
ea8e0af551
GitOrigin-RevId: 591dbefe98423ead89505250c4f46c8ad2610305
28 lines
773 B
JavaScript
28 lines
773 B
JavaScript
const logger = require('@overleaf/logger')
|
|
const settings = require('@overleaf/settings')
|
|
|
|
const mongodb = require('./app/js/mongodb')
|
|
const Server = require('./app/js/server')
|
|
|
|
if (!module.parent) {
|
|
// Called directly
|
|
const port = settings.internal.chat.port
|
|
const host = settings.internal.chat.host
|
|
mongodb
|
|
.waitForDb()
|
|
.then(() => {
|
|
Server.server.listen(port, host, function (err) {
|
|
if (err) {
|
|
logger.fatal({ err }, `Cannot bind to ${host}:${port}. Exiting.`)
|
|
process.exit(1)
|
|
}
|
|
logger.info(`Chat starting up, listening on ${host}:${port}`)
|
|
})
|
|
})
|
|
.catch(err => {
|
|
logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')
|
|
process.exit(1)
|
|
})
|
|
}
|
|
|
|
module.exports = Server.server
|