2023-10-18 04:32:14 -04:00
|
|
|
// Metrics must be initialized before importing anything else
|
|
|
|
import '@overleaf/metrics/initialize.js'
|
|
|
|
|
2022-12-20 07:11:25 -05:00
|
|
|
import Settings from '@overleaf/settings'
|
|
|
|
import logger from '@overleaf/logger'
|
|
|
|
import { app } from './app/js/server.js'
|
|
|
|
import * as ASpell from './app/js/ASpell.js'
|
2023-12-07 05:05:50 -05:00
|
|
|
import Metrics from '@overleaf/metrics'
|
2022-12-20 07:11:25 -05:00
|
|
|
|
2024-04-25 08:56:00 -04:00
|
|
|
const { host = '127.0.0.1', port = 3005 } = Settings.internal?.spelling ?? {}
|
2022-12-20 07:11:25 -05:00
|
|
|
|
|
|
|
ASpell.startCacheDump()
|
|
|
|
|
|
|
|
const server = app.listen(port, host, function (error) {
|
|
|
|
if (error) {
|
|
|
|
throw error
|
|
|
|
}
|
|
|
|
logger.info({ host, port }, 'spelling HTTP server starting up')
|
|
|
|
})
|
|
|
|
|
|
|
|
process.on('SIGTERM', () => {
|
|
|
|
ASpell.stopCacheDump()
|
|
|
|
server.close(() => {
|
|
|
|
logger.info({ host, port }, 'spelling HTTP server closed')
|
2023-12-07 05:05:50 -05:00
|
|
|
Metrics.close()
|
2022-01-06 05:41:31 -05:00
|
|
|
})
|
2022-12-20 07:11:25 -05:00
|
|
|
})
|