Add debug electron setting

This commit is contained in:
Chocobozzz 2016-05-11 20:43:07 +02:00
parent 504b79cb67
commit 09bc69df7a
4 changed files with 17 additions and 7 deletions

View File

@ -20,3 +20,6 @@ storage:
network: network:
friends: [] friends: []
electron:
debug: false

View File

@ -7,3 +7,6 @@ webserver:
database: database:
host: 'localhost' host: 'localhost'
port: 27017 port: 27017
electron:
debug: false

View File

@ -16,7 +16,7 @@ function checkConfig () {
'webserver.https', 'webserver.host', 'webserver.port', 'webserver.https', 'webserver.host', 'webserver.port',
'database.host', 'database.port', 'database.suffix', 'database.host', 'database.port', 'database.suffix',
'storage.certs', 'storage.uploads', 'storage.logs', 'storage.certs', 'storage.uploads', 'storage.logs',
'network.friends' ] 'network.friends', 'electron.debug' ]
const miss = [] const miss = []
for (const key of required) { for (const key of required) {

View File

@ -7,6 +7,7 @@ const spawn = require('electron-spawn')
const logger = require('../helpers/logger') const logger = require('../helpers/logger')
const electron_debug = config.get('electron.debug')
let host = config.get('webserver.host') let host = config.get('webserver.host')
let port = config.get('webserver.port') let port = config.get('webserver.port')
let nodeKey = 'webtorrentnode' + port let nodeKey = 'webtorrentnode' + port
@ -57,13 +58,16 @@ function create (options, callback) {
}) })
const webtorrent_process = spawn(pathUtils.join(__dirname, 'webtorrentProcess.js'), host, port, { detached: true }) const webtorrent_process = spawn(pathUtils.join(__dirname, 'webtorrentProcess.js'), host, port, { detached: true })
webtorrent_process.stderr.on('data', function (data) {
// logger.debug('Webtorrent process stderr: ', data.toString())
})
webtorrent_process.stdout.on('data', function (data) { if (electron_debug === true) {
// logger.debug('Webtorrent process:', data.toString()) webtorrent_process.stderr.on('data', function (data) {
}) logger.debug('Webtorrent process stderr: ', data.toString())
})
webtorrent_process.stdout.on('data', function (data) {
logger.debug('Webtorrent process:', data.toString())
})
}
webtorrent.app = webtorrent_process webtorrent.app = webtorrent_process
}) })