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
This commit is contained in:
brunobg 2020-10-14 10:20:31 -03:00 committed by GitHub
parent ef7e79f99f
commit 24cb041082
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 && Object.keys(ssl).length) {
if (ssl && ssl.key && ssl.cert) {
server = https.createServer(ssl, app); server = https.createServer(ssl, app);
newOptions = restOptions; newOptions = restOptions;