Skip to content

Commit

Permalink
Check for referenes to other containers.
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaei2000 committed Oct 23, 2024
1 parent 5095a40 commit 818457d
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions platform/src/ToolsManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,25 @@ class ToolManager {
}

if (xhr.status === 200) {
// Rewrite URLs in tool config
let baseURL = toolUrl.url.substring(0, toolUrl.url.lastIndexOf("/")); // remove the name of the json file (including the trailing slash)
let toolConfig = xhr.responseText.replaceAll("{{BASE-URL}}", baseURL);

var toolConfig;
let response_text = xhr.responseText;
let response_text_regexp = response_text.match(new RegExp(/{{BASE-URL}}:[0-9]*/));
if (response_text_regexp != null){
// There is a reference to another endpoint, so base URL must be set accordingly (There is a {{BASE-URL}} placeholder plus a port).
var base_url = utility.getBaseURL();
let url_port = response_text_regexp[0];
let path = this.fetchPathByPort(this.getPort(url_port));

toolConfig = response_text.replaceAll(url_port, base_url + path);
}
else{
// Rewrite URLs in tool config
let baseURL = toolUrl.url.substring(0, toolUrl.url.lastIndexOf("/")); // remove the name of the json file (including the trailing slash)
toolConfig = xhr.responseText.replaceAll("{{BASE-URL}}", baseURL);
}



// Now parse tool config
let validatedConfig = this.parseAndValidateToolConfig(toolConfig);
Expand Down

0 comments on commit 818457d

Please sign in to comment.