From 24cb041082156c427589ef826077dbb8301a778d Mon Sep 17 00:00:00 2001 From: brunobg Date: Wed, 14 Oct 2020 10:20:31 -0300 Subject: [PATCH] Allows SNICallback instead of hardcoded key/cert This updates the previous PR https://github.com/peers/peerjs-server/pull/219/ with the current code. It solves #209, allowing ssl options to use SNICallback instead of only a hardcoded key/cert pair. @afrokick I saw you accepted a few PRs this week, any chance this once can be included too? Thanks --- src/index.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index a20c6a4..687accd 100644 --- a/src/index.ts +++ b/src/index.ts @@ -48,8 +48,7 @@ function PeerServer(options: Optional = {}, callback?: (server: Server) let server: Server; const { ssl, ...restOptions } = newOptions; - - if (ssl && ssl.key && ssl.cert) { + if (ssl && Object.keys(ssl).length) { server = https.createServer(ssl, app); newOptions = restOptions;