浏览代码

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 年之前
父节点
当前提交
24cb041082
共有 1 个文件被更改,包括 1 次插入2 次删除
  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;
   let server: Server;
 
 
   const { ssl, ...restOptions } = newOptions;
   const { ssl, ...restOptions } = newOptions;
-
-  if (ssl && ssl.key && ssl.cert) {
+  if (ssl && Object.keys(ssl).length) {
     server = https.createServer(ssl, app);
     server = https.createServer(ssl, app);
 
 
     newOptions = restOptions;
     newOptions = restOptions;