From 05b0dc2d80fd31155b21ad45f75d8e8b5f4bb9ba Mon Sep 17 00:00:00 2001 From: "Kireev, Eugene" Date: Mon, 12 Mar 2018 13:58:35 +1100 Subject: [PATCH 1/3] do not use hjson for plugins.env.js --- plugins.js | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/plugins.js b/plugins.js index 05d245c8a..2e957d30b 100644 --- a/plugins.js +++ b/plugins.js @@ -26,17 +26,20 @@ try { if (PLUGINS_JSON && PLUGINS_JSON.length > 0) { debug('Now using TALK_PLUGINS_JSON environment variable for plugins'); pluginsPath = envPlugins; - } else if (fs.existsSync(customPlugins)) { - debug(`Now using ${customPlugins} for plugins`); - pluginsPath = customPlugins; + plugins = require(pluginsPath); } else { - debug(`Now using ${defaultPlugins} for plugins`); - pluginsPath = defaultPlugins; - } + if (fs.existsSync(customPlugins)) { + debug(`Now using ${customPlugins} for plugins`); + pluginsPath = customPlugins; + } else { + debug(`Now using ${defaultPlugins} for plugins`); + pluginsPath = defaultPlugins; + } - // Load/parse the plugin content using hjson. - const pluginContent = fs.readFileSync(pluginsPath, 'utf8'); - plugins = hjson.parse(pluginContent); + // Load/parse the plugin content using hjson. + const pluginContent = fs.readFileSync(pluginsPath, 'utf8'); + plugins = hjson.parse(pluginContent); + } } catch (err) { if (err.code === 'ENOENT') { console.error( From 77ecc5e8dfd6b79809dac9833e4cdb578757eea7 Mon Sep 17 00:00:00 2001 From: "Kireev, Eugene" Date: Mon, 12 Mar 2018 16:36:42 +1100 Subject: [PATCH 2/3] linting fixes --- plugins.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/plugins.js b/plugins.js index 2e957d30b..9280f508f 100644 --- a/plugins.js +++ b/plugins.js @@ -28,17 +28,17 @@ try { pluginsPath = envPlugins; plugins = require(pluginsPath); } else { - if (fs.existsSync(customPlugins)) { - debug(`Now using ${customPlugins} for plugins`); - pluginsPath = customPlugins; - } else { - debug(`Now using ${defaultPlugins} for plugins`); - pluginsPath = defaultPlugins; - } + if (fs.existsSync(customPlugins)) { + debug(`Now using ${customPlugins} for plugins`); + pluginsPath = customPlugins; + } else { + debug(`Now using ${defaultPlugins} for plugins`); + pluginsPath = defaultPlugins; + } - // Load/parse the plugin content using hjson. - const pluginContent = fs.readFileSync(pluginsPath, 'utf8'); - plugins = hjson.parse(pluginContent); + // Load/parse the plugin content using hjson. + const pluginContent = fs.readFileSync(pluginsPath, 'utf8'); + plugins = hjson.parse(pluginContent); } } catch (err) { if (err.code === 'ENOENT') { From a36960a6f03ab289de3c1c8625921ef70d66c6ab Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Tue, 13 Mar 2018 16:55:02 -0600 Subject: [PATCH 3/3] parse env json the same as the rest, with hjson --- plugins.env.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins.env.js b/plugins.env.js index 7be520cc0..ed3b2cbfd 100644 --- a/plugins.env.js +++ b/plugins.env.js @@ -1 +1,2 @@ -module.exports = JSON.parse(process.env.TALK_PLUGINS_JSON); +const hjson = require('hjson'); +module.exports = hjson.parse(process.env.TALK_PLUGINS_JSON);