-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Expand file tree
/
Copy pathservice.ts
More file actions
executable file
·39 lines (28 loc) · 1.05 KB
/
service.ts
File metadata and controls
executable file
·39 lines (28 loc) · 1.05 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
import { api, getConnection, getTrashCollection } from '@rocket.chat/core-services';
import { startBroker } from '@rocket.chat/network-broker';
import { startTracing } from '@rocket.chat/tracing';
import polka from 'polka';
import { registerServiceModels } from '../../../../apps/meteor/ee/server/lib/registerServiceModels';
const PORT = process.env.PORT || 3034;
(async () => {
const { db, client } = await getConnection();
startTracing({ service: 'authorization-service', db: client });
registerServiceModels(db, await getTrashCollection());
api.setBroker(startBroker());
// need to import service after models are registered
const { Authorization } = await import('../../../../apps/meteor/server/services/authorization/service');
api.registerService(new Authorization());
await api.start();
polka()
.get('/health', async function (_req, res) {
try {
await api.nodeList();
res.end('ok');
} catch (err) {
console.error('Service not healthy', err);
res.writeHead(500);
res.end('not healthy');
}
})
.listen(PORT);
})();