Permalink
Browse files

use figc to process command line arguments

  • Loading branch information...
1 parent ccf05ba commit 908c9a7db93358ba5ac73da3281949e9e65d64aa @tblobaum committed Aug 9, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 index.js
View
13 index.js
@@ -1,17 +1,20 @@
-
-var http = require('http')
+var figc = require('figc')
+ , config = figc(process.cwd() + '/fleet-panel.json')
+ , http = require('http')
, shoe = require('shoe')
, ecstatic = require('ecstatic')(__dirname + '/public')
, dnode = require('dnode')
, server = http.createServer(ecstatic)
-server.listen(process.argv[2] || 3000)
+server.listen(config.port || 3000)
// if you are running fleet-panel from the
// same origin as a fleet-hub then this is not needed
-
var sock = shoe(function (stream) {
- dnode.connect(process.argv[4] || 9000, process.argv[3] || 'localhost', function (remote, conn) {
+ dnode.connect({
+ port : config.hub.split(':')[1]
+ , host : config.hub.split(':')[0]
+ }, function (remote, conn) {
var d = dnode(remote)
d.pipe(stream).pipe(d)
})

0 comments on commit 908c9a7

Please sign in to comment.