From: Chocobozzz Date: Wed, 11 May 2016 18:43:07 +0000 (+0200) Subject: Add debug electron setting X-Git-Tag: v0.0.1-alpha~944 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=09bc69df7a82ff7c7a3bc4d8c9feef8a64a7c517;p=oweals%2Fpeertube.git Add debug electron setting --- diff --git a/config/default.yaml b/config/default.yaml index 87b72aa3b..b5fd7b06d 100644 --- a/config/default.yaml +++ b/config/default.yaml @@ -20,3 +20,6 @@ storage: network: friends: [] + +electron: + debug: false diff --git a/config/test.yaml b/config/test.yaml index 8a667a001..7f893bc4f 100644 --- a/config/test.yaml +++ b/config/test.yaml @@ -7,3 +7,6 @@ webserver: database: host: 'localhost' port: 27017 + +electron: + debug: false diff --git a/server/initializers/checker.js b/server/initializers/checker.js index cb62fabf4..7a2b5b132 100644 --- a/server/initializers/checker.js +++ b/server/initializers/checker.js @@ -16,7 +16,7 @@ function checkConfig () { 'webserver.https', 'webserver.host', 'webserver.port', 'database.host', 'database.port', 'database.suffix', 'storage.certs', 'storage.uploads', 'storage.logs', - 'network.friends' ] + 'network.friends', 'electron.debug' ] const miss = [] for (const key of required) { diff --git a/server/lib/webtorrent.js b/server/lib/webtorrent.js index e2e2586f9..656f8c7a8 100644 --- a/server/lib/webtorrent.js +++ b/server/lib/webtorrent.js @@ -7,6 +7,7 @@ const spawn = require('electron-spawn') const logger = require('../helpers/logger') +const electron_debug = config.get('electron.debug') let host = config.get('webserver.host') let port = config.get('webserver.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 }) - 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()) - }) + if (electron_debug === true) { + 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 })