aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/webTorrentNode.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/webTorrentNode.js')
-rw-r--r--src/webTorrentNode.js28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/webTorrentNode.js b/src/webTorrentNode.js
index 03bff7803..ebe8d5d81 100644
--- a/src/webTorrentNode.js
+++ b/src/webTorrentNode.js
@@ -8,16 +8,8 @@
8 8
9 var logger = require('./logger') 9 var logger = require('./logger')
10 10
11 var host 11 var host = config.get('webserver.host')
12 var port 12 var port = config.get('webserver.port')
13
14 try {
15 host = config.get('webserver.host')
16 port = config.get('webserver.port')
17 } catch (e) {
18 host = 'client'
19 port = 1
20 }
21 13
22 var nodeKey = 'webtorrentnode' + port 14 var nodeKey = 'webtorrentnode' + port
23 var processKey = 'webtorrent' + port 15 var processKey = 'webtorrent' + port
@@ -33,7 +25,21 @@
33 // Useful to kill it 25 // Useful to kill it
34 webtorrentnode.app = null 26 webtorrentnode.app = null
35 27
36 webtorrentnode.create = function (callback) { 28 webtorrentnode.create = function (options, callback) {
29 if (typeof options === 'function') {
30 callback = options
31 options = {}
32 }
33
34 // Override options
35 if (options.host) host = options.host
36 if (options.port) {
37 port = options.port
38 nodeKey = 'webtorrentnode' + port
39 processKey = 'webtorrent' + port
40 ipc.config.id = nodeKey
41 }
42
37 ipc.serve(function () { 43 ipc.serve(function () {
38 if (!webtorrentnode.silent) logger.info('IPC server ready.') 44 if (!webtorrentnode.silent) logger.info('IPC server ready.')
39 45