diff --git a/README.md b/README.md index 74d57a6c..d22ae5ce 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,8 @@ This will install `http-server` globally so that it may be run from the command `-K` or `--key` Path to ssl key file (default: key.pem). + `-P` or `--passphrase` Pass phrase to decrypt the key (optional). + `-r` or `--robots` Provide a /robots.txt (whose content defaults to 'User-agent: *\nDisallow: /') `-h` or `--help` Print this list and exit. diff --git a/bin/http-server b/bin/http-server index 926e0dd7..f9d49300 100755 --- a/bin/http-server +++ b/bin/http-server @@ -37,6 +37,7 @@ if (argv.h || argv.help) { ' -S --ssl Enable https.', ' -C --cert Path to ssl cert file (default: cert.pem).', ' -K --key Path to ssl key file (default: key.pem).', + ' -P --passphrase Pass phrase to decrypt the key (optional)', '', ' -r --robots Respond to /robots.txt [User-agent: *\\nDisallow: /]', ' --no-dotfiles Do not show dotfiles', @@ -118,6 +119,9 @@ function listen(port) { cert: argv.C || argv.cert || 'cert.pem', key: argv.K || argv.key || 'key.pem' }; + if (argv.P || argv.passphrase) { + options.https.passphrase = argv.P || argv.passphrase; + } } var server = httpServer.createServer(options);