backtrace-service
Advanced tools
Comparing version 3.0.8-alpha7 to 3.0.8-alpha8
@@ -79,2 +79,3 @@ "use strict"; | ||
var ProjectValidation = __importStar(require("../service/projectValidation")); | ||
var backtraceUniverseHelper_1 = require("../universe/backtraceUniverseHelper"); | ||
/** | ||
@@ -310,3 +311,3 @@ * Identity manager | ||
prefix = coronerdUrl.endsWith('/') ? '' : '/'; | ||
protocol = coronerdUrl.startsWith('http') ? '' : 'http://'; | ||
protocol = coronerdUrl.startsWith('http') ? '' : backtraceUniverseHelper_1.http; | ||
requestUrl = "" + protocol + coronerdUrl + prefix + "api/login"; | ||
@@ -345,3 +346,3 @@ nonce = crypto_1.randomBytes(32).toString('hex'); | ||
return __awaiter(this, void 0, void 0, function () { | ||
var prefix, protocol, requestUrl, result, cfg, universes, err_3; | ||
var prefix, protocol, bpgUniverseRequestUrl, bpgUniverseRequestData, bpgUniverseResult, bpgUniverseObjects, err_3; | ||
var _this = this; | ||
@@ -355,8 +356,10 @@ return __generator(this, function (_b) { | ||
prefix = coronerdUrl.endsWith('/') ? '' : '/'; | ||
protocol = coronerdUrl.startsWith('http') ? '' : 'http://'; | ||
requestUrl = "" + protocol + coronerdUrl + prefix + "api/login"; | ||
protocol = coronerdUrl.startsWith('http') ? '' : backtraceUniverseHelper_1.http; | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, axios_1.default.post(requestUrl, null, { | ||
bpgUniverseRequestUrl = "" + protocol + coronerdUrl + prefix + "api/bpg"; | ||
bpgUniverseRequestData = { 'actions': [{ 'action': 'get', 'type': 'configuration/universe' }] }; | ||
return [4 /*yield*/, axios_1.default | ||
.post(bpgUniverseRequestUrl, bpgUniverseRequestData, { | ||
httpsAgent: this.httpsAgent, | ||
@@ -367,17 +370,17 @@ headers: { | ||
'X-Service-HMAC': hmac, | ||
'Content-Type': 'application/json' | ||
}, | ||
})]; | ||
case 2: | ||
result = _b.sent(); | ||
cfg = result.status === 200 ? result.data : undefined; | ||
if (cfg === null || cfg === void 0 ? void 0 : cfg.universes) { | ||
universes = Object.keys(cfg.universes); | ||
universes.forEach(function (universe) { | ||
_this.registeredUniverses[universe] = __assign({}, coronerdData); | ||
}); | ||
} | ||
bpgUniverseResult = _b.sent(); | ||
bpgUniverseObjects = bpgUniverseResult.data.results[0].result; | ||
bpgUniverseObjects.forEach(function (universe) { | ||
if (universe.deleted !== 1) { | ||
_this.registeredUniverses[universe.name] = __assign({}, coronerdData); | ||
} | ||
}); | ||
return [3 /*break*/, 4]; | ||
case 3: | ||
err_3 = _b.sent(); | ||
this.log('error', "Cannot login to coronerd. Reason " + err_3.message); | ||
this.log('error', "Cannot get universes from coronerd. Reason " + err_3.message); | ||
return [2 /*return*/, undefined]; | ||
@@ -424,3 +427,3 @@ case 4: return [2 /*return*/]; | ||
prefix = universeUrl.endsWith('/') ? '' : '/'; | ||
protocol = universeUrl.startsWith('http') ? '' : 'http://'; | ||
protocol = universeUrl.startsWith('http') ? '' : backtraceUniverseHelper_1.http; | ||
requestUrl = "" + protocol + universeUrl + prefix + "api/config"; | ||
@@ -479,3 +482,3 @@ _a.label = 1; | ||
if (data.url && !data.url.startsWith('http')) { | ||
data.url = "http://" + data.url; | ||
data.url = "" + backtraceUniverseHelper_1.http + data.url; | ||
} | ||
@@ -482,0 +485,0 @@ request.coronerAuth = data; |
import { IServerConfiguration } from '../identity/model/serverConfiguration'; | ||
export declare const https = "https://"; | ||
export declare const http = "http://"; | ||
/** | ||
@@ -3,0 +5,0 @@ * Backtrae universe utils |
@@ -22,6 +22,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.UniverseHelper = void 0; | ||
exports.UniverseHelper = exports.http = exports.https = void 0; | ||
var url = __importStar(require("url")); | ||
var https = 'https://'; | ||
var http = 'http://'; | ||
exports.https = 'https://'; | ||
exports.http = 'http://'; | ||
/** | ||
@@ -74,7 +74,7 @@ * Backtrae universe utils | ||
UniverseHelper.removeProtocol = function (str) { | ||
if (str.startsWith(https)) { | ||
return str.substring(https.length); | ||
if (str.startsWith(exports.https)) { | ||
return str.substring(exports.https.length); | ||
} | ||
if (str.startsWith(http)) { | ||
return str.substring(http.length); | ||
if (str.startsWith(exports.http)) { | ||
return str.substring(exports.http.length); | ||
} | ||
@@ -81,0 +81,0 @@ return str; |
{ | ||
"name": "backtrace-service", | ||
"version": "3.0.8-alpha7", | ||
"version": "3.0.8-alpha8", | ||
"description": "Common tools for Backtrace Node services", | ||
@@ -5,0 +5,0 @@ "author": "Backtrace", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
165855
73
2322