From 6e4909557dd126c44dfe1b7116f6dd384998506d Mon Sep 17 00:00:00 2001 From: Elio Bischof Date: Wed, 24 May 2023 15:07:55 +0200 Subject: [PATCH] chore(dev): fix fetching http env json (#5921) --- console/prebuild.development.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/console/prebuild.development.js b/console/prebuild.development.js index 01cd1135e4..49a36a5efb 100644 --- a/console/prebuild.development.js +++ b/console/prebuild.development.js @@ -1,12 +1,17 @@ var fs = require('fs'); var path = require('path') +var http = require('http'); var https = require('https'); +var urlModule = require('url'); var defaultEnvironmentJsonURL = 'http://localhost:8080/ui/console/assets/environment.json' var devEnvFile = path.join(__dirname, "src", "assets", "environment.json") var url = process.env["ENVIRONMENT_JSON_URL"] || defaultEnvironmentJsonURL; -https.get(url, function (res) { +var protocol = urlModule.parse(url).protocol; +var getter = protocol === 'https:' ? https.get : http.get; + +getter(url, function (res) { var body = ''; res.on('data', function (chunk) {