Compare commits
2 Commits
3dc377f9e6
...
d397b32ab5
| Author | SHA1 | Date | |
|---|---|---|---|
| d397b32ab5 | |||
| 4ce9471a8e |
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "baudy",
|
||||
"version": "0.0.8",
|
||||
"version": "0.0.9",
|
||||
"module": "index.tsx",
|
||||
"type": "module",
|
||||
"bin": {
|
||||
|
|
|
|||
|
|
@ -22,16 +22,26 @@ app.get('/ggwave.js', () =>
|
|||
|
||||
startup(PORT)
|
||||
|
||||
const hasCerts = await Bun.file('./certs/cert.pem').exists()
|
||||
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()
|
||||
|
||||
export default {
|
||||
...app.defaults,
|
||||
port: PORT,
|
||||
idleTimeout: 255,
|
||||
...(hasCerts && {
|
||||
tls: {
|
||||
key: Bun.file('./certs/key.pem'),
|
||||
cert: Bun.file('./certs/cert.pem'),
|
||||
},
|
||||
}),
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user