Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

allow the cli tool to be used with tls

  • Loading branch information...
commit 3b1aebe36f4a765cc284b37c05975cd0c9873c86 1 parent 31e425d
@natesilva authored
Showing with 10 additions and 2 deletions.
  1. +10 −2 bin/bouncy.js
View
12 bin/bouncy.js
@@ -1,17 +1,25 @@
#!/usr/bin/env node
var configFile = process.argv[2];
var port = parseInt(process.argv[3], 10);
+var key = process.argv[4];
+var cert = process.argv[5];
if (!configFile || !port) {
- console.error('Usage: bouncy [routes.json] [port]');
+ console.error('Usage: bouncy [routes.json] [port] [keyfile] [certfile]');
process.exit(1);
}
var fs = require('fs');
var config = JSON.parse(fs.readFileSync(configFile));
+var opts = {};
+if (key && cert) {
+ opts.key = fs.readFileSync(key);
+ opts.cert = fs.readFileSync(cert);
+}
+
var bouncy = require('bouncy');
-bouncy(function (req, bounce) {
+bouncy(opts, function (req, bounce) {
var host = (req.headers.host || '').replace(/:\d+$/, '');
var route = config[host] || config[''];
Please sign in to comment.
Something went wrong with that request. Please try again.