mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-25 21:22:13 +00:00
afa66aef49
Migrate chat service to OpenAPI : (Revert of the Revert) GitOrigin-RevId: 77a34fef20f77344e01461d42b531c623cf28203
23 lines
711 B
JavaScript
23 lines
711 B
JavaScript
import logger from '@overleaf/logger'
|
|
import settings from '@overleaf/settings'
|
|
import { mongoClient } from './app/js/mongodb.js'
|
|
import { createServer } from './app/js/server.js'
|
|
|
|
const port = settings.internal.chat.port
|
|
const host = settings.internal.chat.host
|
|
mongoClient
|
|
.connect()
|
|
.then(async () => {
|
|
const { server } = await createServer()
|
|
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}`)
|
|
})
|
|
})
|
|
.catch(err => {
|
|
logger.fatal({ err }, 'Cannot connect to mongo. Exiting.')
|
|
process.exit(1)
|
|
})
|