Make TLS optional when certs don't exist

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Corey Johnson 2026-03-12 13:39:21 -07:00
parent 789825614e
commit 4b8ca04f25

View File

@ -22,12 +22,16 @@ app.get('/ggwave.js', () =>
startup(PORT) startup(PORT)
const hasCerts = await Bun.file('./certs/cert.pem').exists()
export default { export default {
...app.defaults, ...app.defaults,
port: PORT, port: PORT,
idleTimeout: 255, idleTimeout: 255,
tls: { ...(hasCerts && {
key: Bun.file('./certs/key.pem'), tls: {
cert: Bun.file('./certs/cert.pem'), key: Bun.file('./certs/key.pem'),
}, cert: Bun.file('./certs/cert.pem'),
},
}),
} }