Skip to content

Commit

Permalink
Support for passphrase when used for a private key
Browse files Browse the repository at this point in the history
  • Loading branch information
schemburkar committed Jul 30, 2020
1 parent d0f76c5 commit 1a0a60d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions bin/serve.js
Expand Up @@ -95,7 +95,7 @@ const getHelp = () => chalk`
--ssl-key Optional path to the SSL/TLS certificate\'s private key
--ssl-passphrase Optional passphrase of the SSL/TLS certificate
--ssl-passphrase Optional passphrase used for a private key or a SSL/TLS (PFX) certificate
--ssl-format Optional format of the SSL/TLS certificate.
{grey Supported formats: pem (default) and pfx}
Expand Down Expand Up @@ -209,10 +209,14 @@ const startEndpoint = (endpoint, config, args, previous) => {
break;
case 'pem':
default:
server = https.createServer({
const serverOptions = {
key: fs.readFileSync(args['--ssl-key']),
cert: fs.readFileSync(args['--ssl-cert'])
}, serverHandler);
};
if(args['--ssl-passphrase']){
serverOptions.passphrase = args['--ssl-passphrase'];
}
server = https.createServer(serverOptions, serverHandler);
break;
}
} else {
Expand Down

0 comments on commit 1a0a60d

Please sign in to comment.