ClientOnly: Global variable name used in callback function.

The global 'config' variable is used in the callback function, changed to local one. Unwanted behaviour when accessing server on docker or if using 0.0.0.0 or blank address in config file as it just passes this to electron to display.
This commit is contained in:
ccrlawrence
2018-08-26 15:53:01 +01:00
committed by GitHub
parent 6aa156d956
commit fa1f35a89e

View File

@@ -62,13 +62,13 @@
// Only start the client if a non-local server was provided // Only start the client if a non-local server was provided
if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].indexOf(config.address) === -1) { if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].indexOf(config.address) === -1) {
getServerConfig(`http://${config.address}:${config.port}/config/`) getServerConfig(`http://${config.address}:${config.port}/config/`)
.then(function (config) { .then(function (configReturn) {
// Pass along the server config via an environment variable // Pass along the server config via an environment variable
var env = Object.create(process.env); var env = Object.create(process.env);
var options = { env: env }; var options = { env: env };
config.address = config.address; configReturn.address = config.address;
config.port = config.port; configReturn.port = config.port;
env.config = JSON.stringify(config); env.config = JSON.stringify(configReturn);
// Spawn electron application // Spawn electron application
const electron = require("electron"); const electron = require("electron");