fix: set debug env variable on remote electron process (#1789)

We fix the DEBUG environment variable by setting it on the `electron.remote`
instead, and we also move the code to `lib/gui/app.js` and away from
`lib/gui/index.html`.

Changelog-Entry: Set the DEBUG environment variable on the remote
electron process.
Change-Type: patch

* use debug.enabled, fix drivelist env setting
* fix: set debug env variable on remote electron process
This commit is contained in:
Benedict Aas 2017-10-27 19:42:57 +01:00 committed by Jonas Hermsmeier
parent f2f5955264
commit 9815f9a5a1
4 changed files with 10 additions and 12 deletions

View File

@ -47,6 +47,14 @@ const driveScanner = require('./modules/drive-scanner')
const osDialog = require('./os/dialog')
const exceptionReporter = require('./modules/exception-reporter')
// Enable debug information from all modules that use `debug`
// See https://github.com/visionmedia/debug#browser-support
//
// Enable drivelist debugging information
// See https://github.com/resin-io-modules/drivelist
electron.remote.process.env.DRIVELIST_DEBUG = /drivelist|^\*$/i.test(electron.remote.process.env.DEBUG) ? '1' : ''
window.localStorage.debug = electron.remote.process.env.DEBUG
const app = angular.module('Etcher', [
require('angular-ui-router'),
require('angular-ui-bootstrap'),

View File

@ -6,16 +6,6 @@
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="css/desktop.css">
<link rel="stylesheet" type="text/css" href="css/angular.css">
<!-- Enable debug information from all modules that use `debug` -->
<!-- See https://github.com/visionmedia/debug#browser-support -->
<script>
// Enable drivelist debugging information
// See https://github.com/resin-io-modules/drivelist
process.env['DRIVELIST_DEBUG'] = /drivelist|^\*$/i.test(process.env['DEBUG']) ? '1' : '';
window.localStorage.debug = process.env['DEBUG'];
</script>
<script src="./app.js"></script>
</head>
<body ng-app="Etcher">

View File

@ -31,6 +31,8 @@ const utils = require('../../utils')
debug.enabled = true
debug.enabled = true
/**
* @summary The radix used by USB ID numbers
* @type {Number}

View File

@ -16,8 +16,6 @@
'use strict'
process.env.DEBUG = `sdk:usbboot,${process.env.DEBUG}`
// See http://electron.atom.io/docs/v0.37.7/api/environment-variables/#electronrunasnode
//
// Notice that if running electron with `ELECTRON_RUN_AS_NODE`, the binary