-
Notifications
You must be signed in to change notification settings - Fork 9
/
index.js
executable file
·48 lines (43 loc) · 1.1 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// index.js for bitty.js terminal shell server
//
// Copyright 2013 Bill Roy (MIT License)
//
var opt = require('optimist');
var argv = opt.usage('Usage: $0 [flags]')
.alias('p', 'port')
.describe('p', 'virtual serial port name (auto-detects FTDI ports on Mac/Linux)')
.alias('b', 'baud')
.describe('b', 'virtual serial port baud rate (default 57600)')
.alias('h', 'http')
.describe('h', 'http port (default 8080)')
.argv;
if (argv.help) {
opt.showHelp();
process.exit();
}
var shellargs = [process.cwd() + '/bitty.js'];
if (argv.port) { shellargs.push('-p'); shellargs.push(argv.port); }
if (argv.baud) { shellargs.push('-b'); shellargs.push(argv.baud); }
var config = {
'users': {
'bitlash':'open sesame'
},
// 'hostname': '0.0.0.0', // to serve on all ports instead of just localhost
'https': {
'key': null,
'cert': null
},
'port': argv.http || 8080,
'shell': 'node',
'shellArgs': shellargs,
'limitGlobal': 1,
'limitPerUser': 1,
'term': {}
// visualBell: true
// }
};
var tty = require('tty.js');
var app = tty.createServer(config);
app.listen();
module.exports = app;