overleaf/services/spelling/app.js
Christopher Hoskin 5855ba7b49 Merge pull request #15241 from overleaf/em-gcp-opentelemetry
Replace the GCP trace agent with OpenTelemetry

GitOrigin-RevId: 591410029349e4ef5a39a5b79868e57c7bd089b6
2023-10-19 08:02:52 +00:00

25 lines
686 B
JavaScript

// Metrics must be initialized before importing anything else
import '@overleaf/metrics/initialize.js'
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'
const { host = 'localhost', port = 3005 } = Settings.internal?.spelling ?? {}
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')
})
})