-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy.js
32 lines (26 loc) · 843 Bytes
/
proxy.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
/* Yakbak Simple Server
*
* REMOTE_SERVER - the endpoint you want to proxy
* PROXY_PORT - the proxy port (defaults to 7000)
*
*/
var http = require('http');
var yakbak = require('yakbak');
var remoteServer = process.env.REMOTE_SERVER || process.argv[2];
var proxyPort = process.env.PROXY_PORT || 7000;
if(remoteServer == undefined) {
console.error('! You must provide an remote server as an arg');
process.exit(-1);
}
console.info('yakbak');
console.info('---------------------------------------------------------------');
console.info('Remote server: ' + remoteServer);
console.info('Local proxy: http://localhost:' + proxyPort);
console.info('')
console.info('Hit ^C to exit')
process.on('SIGINT', function() {
process.exit();
});
http.createServer(yakbak(remoteServer, {
dirname: '/tapes'
})).listen(proxyPort);