chore(dev): fix fetching http env json (#5921)

This commit is contained in:
Elio Bischof 2023-05-24 15:07:55 +02:00 committed by GitHub
parent 0d7495b8ed
commit 6e4909557d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {