From b3731ad27f9e4feddb25d409104db421cd145eba Mon Sep 17 00:00:00 2001 From: Ryan Blenis Date: Mon, 11 Nov 2019 10:47:30 -0500 Subject: [PATCH] Support http or https for config URL's --- pluginHandler.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pluginHandler.js b/pluginHandler.js index 9334aa0b..83f5d194 100644 --- a/pluginHandler.js +++ b/pluginHandler.js @@ -201,9 +201,13 @@ module.exports.pluginHandler = function (parent) { obj.getPluginConfig = function(configUrl) { return new Promise(function(resolve, reject) { - var https = require('https'); + if (configUrl.indexOf('https://') >= 0) { + var http = require('https'); + } else { + var http = require('http'); + } if (configUrl.indexOf('://') === -1) reject('Unable to fetch the config: Bad URL (' + configUrl + ')'); - https.get(configUrl, function(res) { + http.get(configUrl, function(res) { var configStr = ''; res.on('data', function(chunk){ configStr += chunk;