2022-12-13 07:37:49 -05:00
|
|
|
import logger from '@overleaf/logger'
|
|
|
|
import settings from '@overleaf/settings'
|
|
|
|
import { mongoClient } from './app/js/mongodb.js'
|
2022-12-21 10:39:13 -05:00
|
|
|
import { server } from './app/js/server.js'
|
2014-08-15 05:50:36 -04:00
|
|
|
|
2022-12-13 07:37:49 -05:00
|
|
|
const port = settings.internal.chat.port
|
|
|
|
const host = settings.internal.chat.host
|
|
|
|
mongoClient
|
|
|
|
.connect()
|
2022-12-21 10:39:13 -05:00
|
|
|
.then(() => {
|
2022-12-13 07:37:49 -05:00
|
|
|
server.listen(port, host, function (err) {
|
|
|
|
if (err) {
|
|
|
|
logger.fatal({ err }, `Cannot bind to ${host}:${port}. Exiting.`)
|
|
|
|
process.exit(1)
|
|
|
|
}
|
|
|
|
logger.debug(`Chat starting up, listening on ${host}:${port}`)
|
2020-08-19 08:06:22 -04:00
|
|
|
})
|
2022-12-13 07:37:49 -05:00
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')
|
|
|
|
process.exit(1)
|
|
|
|
})
|