Compare commits

..

No commits in common. "d397b32ab557e8c0f892eed1e36accc7e2f66e90" and "3dc377f9e6a7f3ab23bd57f6b4ce6f46893c0a77" have entirely different histories.

2 changed files with 8 additions and 18 deletions

View File

@ -1,6 +1,6 @@
{
"name": "baudy",
"version": "0.0.9",
"version": "0.0.8",
"module": "index.tsx",
"type": "module",
"bin": {

View File

@ -22,26 +22,16 @@ app.get('/ggwave.js', () =>
startup(PORT)
async function ensureCerts() {
const certPath = './certs/cert.pem'
const keyPath = './certs/key.pem'
if (await Bun.file(certPath).exists()) return
const { mkdirSync } = await import('fs')
mkdirSync('./certs', { recursive: true })
Bun.spawnSync(['openssl', 'req', '-x509', '-newkey', 'rsa:2048',
'-keyout', keyPath, '-out', certPath,
'-days', '365', '-nodes', '-subj', '/CN=localhost'])
}
await ensureCerts()
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'),
},
}),
}