fix: admin: shouldn't show key/cert errors if https is off

Massimo Melina committed Mar 12, 2022 at 21:46 UTC 19b7a7d6e96b9f474e24bab8c322a5f32214ad11
1 file changed +1 -1
server/src/listen.ts
+1 -1
@@ -56,7 +56,7 @@ async function considerHttps() {
56 await stopServer(httpsSrv)
57 let port = getConfig('https_port')
58 try {
59 - httpsSrv = https.createServer({ key: httpsNeeds.private_key, cert: httpsNeeds.cert }, app.callback())
59 + httpsSrv = https.createServer(port < 0 ? {} : { key: httpsNeeds.private_key, cert: httpsNeeds.cert }, app.callback())
60 const missingKey = _.findKey(httpsNeeds, v => !v) as keyof typeof httpsNeeds
61 httpsSrv.error = port < 0 ? undefined
62 : missingKey && prefix(getConfig(missingKey) ? "cannot read file for " : "missing ", httpsNeedsNames[missingKey])