MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / main

Function main

kms/auth-eth/src/main.ts:11–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9config();
10
11async function main() {
12 try {
13 const port = process.env.PORT ? parseInt(process.env.PORT) : 8000;
14 const host = process.env.HOST || '127.0.0.1';
15
16 const server = await build();
17 await server.listen({ port, host });
18 console.log(`Server listening on ${host}:${port}`);
19
20 // Handle graceful shutdown
21 const signals = ['SIGINT', 'SIGTERM'];
22 for (const signal of signals) {
23 process.on(signal, async () => {
24 try {
25 await server.close();
26 process.exit(0);
27 } catch (err) {
28 console.error('Error during shutdown:', err);
29 process.exit(1);
30 }
31 });
32 }
33 } catch (err) {
34 console.error('Error starting server:', err);
35 process.exit(1);
36 }
37}
38
39main();

Callers 1

main.tsFile · 0.70

Calls 3

buildFunction · 0.90
onMethod · 0.65
exitMethod · 0.45

Tested by

no test coverage detected