Browse Source

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
brunobg 4 years ago
parent
commit
24cb041082
1 changed files with 1 additions and 2 deletions
  1. 1 2
      src/index.ts

+ 1 - 2
src/index.ts

@@ -48,8 +48,7 @@ function PeerServer(options: Optional<IConfig> = {}, 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;