about summary refs log tree commit diff stats
path: root/src/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/index.ts')
-rw-r--r--src/index.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/index.ts b/src/index.ts
index c18ebb2..bb492d0 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -9,3 +9,15 @@ console.info(`Metrics server started on port ${metricsServed.port}`);
 
 const served = Bun.serve(server);
 console.info(`Serving website on http://${served.hostname}:${served.port}/`);
+
+process.on("SIGTERM", function () {
+  log.info("SIGTERM received, shutting down...");
+  metricsServed.stop();
+  served.stop();
+});
+
+process.on("SIGINT", function () {
+  log.info("SIGINT received, shutting down...");
+  metricsServed.stop();
+  served.stop();
+});