From 4b8ca04f25966aec3ef5a0c4b664c95a2f11a25d Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Thu, 12 Mar 2026 13:39:21 -0700 Subject: [PATCH] Make TLS optional when certs don't exist Co-Authored-By: Claude Opus 4.6 --- src/server/index.tsx | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/server/index.tsx b/src/server/index.tsx index 31ceb77..1457df5 100644 --- a/src/server/index.tsx +++ b/src/server/index.tsx @@ -22,12 +22,16 @@ app.get('/ggwave.js', () => startup(PORT) +const hasCerts = await Bun.file('./certs/cert.pem').exists() + export default { ...app.defaults, port: PORT, idleTimeout: 255, - tls: { - key: Bun.file('./certs/key.pem'), - cert: Bun.file('./certs/cert.pem'), - }, + ...(hasCerts && { + tls: { + key: Bun.file('./certs/key.pem'), + cert: Bun.file('./certs/cert.pem'), + }, + }), }