From cc07f1d3d7b69c92e6110e8043f781bab8200d27 Mon Sep 17 00:00:00 2001 From: "Michael Bradley, Jr" Date: Tue, 21 Aug 2018 18:33:39 -0500 Subject: [PATCH] config should be stringified only once --- lib/modules/whisper/index.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/modules/whisper/index.js b/lib/modules/whisper/index.js index 3ce7ddfa..7b4a6dfb 100644 --- a/lib/modules/whisper/index.js +++ b/lib/modules/whisper/index.js @@ -75,15 +75,13 @@ class Whisper { let connection = this.communicationConfig.connection || {}; // todo: make the add code a function as well - let config = JSON.stringify({ + let config = { server: canonicalHost(connection.host || defaultHost), port: connection.port || '8546', type: connection.type || 'ws' - }); + }; - config = JSON.stringify(config); - - let code = "\nEmbarkJS.Messages.setProvider('whisper'," + config + ");"; + let code = `\nEmbarkJS.Messages.setProvider('whisper', ${JSON.stringify(config)});`; let shouldInit = (communicationConfig) => { return (communicationConfig.provider === 'whisper' && communicationConfig.enabled === true);