Skip to content
This repository

allow the cli tool to be used with tls #35

Open
wants to merge 1 commit into from

2 participants

Nate Silva Don't Add Me To Your Organization a.k.a The Travis Bot
Nate Silva

This was a simple change, so maybe there’s a reason you haven’t implemented it already. In any case:

Previously, TLS could only be used by writing code and passing in the correct opts to the bouncy() funciton.

If you weren’t using TLS, you could use the simpler command-line utility.

This adds two optional arguments to the command-line utility to support TLS usage, without breaking existing non-TLS code.

Don't Add Me To Your Organization a.k.a The Travis Bot

This pull request fails (merged 3b1aebe into 31e425d).

Nate Silva

As far as I can tell, the failure mentioned by @travisbot was not caused by my commit. The failed unit test (test/raw_destroy.js) does not use or reference the CLI tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 20, 2012
Nate Silva allow the cli tool to be used with tls 3b1aebe
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 10 additions and 2 deletions. Show diff stats Hide diff stats

  1. 12  bin/bouncy.js
12  bin/bouncy.js
... ...
@@ -1,17 +1,25 @@
1 1
 #!/usr/bin/env node
2 2
 var configFile = process.argv[2];
3 3
 var port = parseInt(process.argv[3], 10);
  4
+var key = process.argv[4];
  5
+var cert = process.argv[5];
4 6
 
5 7
 if (!configFile || !port) {
6  
-    console.error('Usage: bouncy [routes.json] [port]');
  8
+    console.error('Usage: bouncy [routes.json] [port] [keyfile] [certfile]');
7 9
     process.exit(1);
8 10
 }
9 11
 
10 12
 var fs = require('fs');
11 13
 var config = JSON.parse(fs.readFileSync(configFile));
12 14
 
  15
+var opts = {};
  16
+if (key && cert) {
  17
+    opts.key = fs.readFileSync(key);
  18
+    opts.cert = fs.readFileSync(cert);
  19
+}
  20
+
13 21
 var bouncy = require('bouncy');
14  
-bouncy(function (req, bounce) {
  22
+bouncy(opts, function (req, bounce) {
15 23
     var host = (req.headers.host || '').replace(/:\d+$/, '');
16 24
     var route = config[host] || config[''];
17 25
     
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.