Compare commits
No commits in common. "d397b32ab557e8c0f892eed1e36accc7e2f66e90" and "3dc377f9e6a7f3ab23bd57f6b4ce6f46893c0a77" have entirely different histories.
d397b32ab5
...
3dc377f9e6
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "baudy",
|
"name": "baudy",
|
||||||
"version": "0.0.9",
|
"version": "0.0.8",
|
||||||
"module": "index.tsx",
|
"module": "index.tsx",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"bin": {
|
"bin": {
|
||||||
|
|
|
||||||
|
|
@ -22,26 +22,16 @@ app.get('/ggwave.js', () =>
|
||||||
|
|
||||||
startup(PORT)
|
startup(PORT)
|
||||||
|
|
||||||
async function ensureCerts() {
|
const hasCerts = await Bun.file('./certs/cert.pem').exists()
|
||||||
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 {
|
export default {
|
||||||
...app.defaults,
|
...app.defaults,
|
||||||
port: PORT,
|
port: PORT,
|
||||||
idleTimeout: 255,
|
idleTimeout: 255,
|
||||||
|
...(hasCerts && {
|
||||||
tls: {
|
tls: {
|
||||||
key: Bun.file('./certs/key.pem'),
|
key: Bun.file('./certs/key.pem'),
|
||||||
cert: Bun.file('./certs/cert.pem'),
|
cert: Bun.file('./certs/cert.pem'),
|
||||||
},
|
},
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user