forked from badges/shields
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
54 lines (46 loc) · 1.53 KB
/
server.js
File metadata and controls
54 lines (46 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import configModule from 'config'
import * as Sentry from '@sentry/node'
import Server from './core/server/server.js'
// Set up Sentry reporting as early in the process as possible.
const config = configModule.util.toObject()
const disabledIntegrations = ['Console', 'Http']
Sentry.init({
dsn: process.env.SENTRY_DSN || config.private.sentry_dsn,
integrations: integrations => {
const filtered = integrations.filter(
integration => !disabledIntegrations.includes(integration.name),
)
if (filtered.length !== integrations.length - disabledIntegrations.length) {
throw Error(
`An error occurred while filtering integrations. The following integrations were found: ${integrations.map(
({ name }) => name,
)}`,
)
}
return filtered
},
})
if (+process.argv[2]) {
config.public.bind.port = +process.argv[2]
}
if (process.argv[3]) {
config.public.bind.address = process.argv[3]
}
console.log('Configuration:')
console.dir(config.public, { depth: null })
if (config.public.fetchLimit != null) {
console.error(
'fetchLimit is no longer supported, its value will be ignored. Please remove it from your config and use fetchLimitBytes instead.',
)
}
if (config.public.cors != null) {
console.error(
'cors.allowedOrigin is no longer supported, its value will be ignored. Please remove it from your config.',
)
}
export const server = new Server(config)
process.on('SIGTERM', async () => {
console.log('SIGTERM received, shutting down...')
await server.stop()
})
await server.start()