Skip to content

Commit 4b9a602

Browse files
Introduce integration API url config
1 parent a4dd731 commit 4b9a602

File tree

7 files changed

+20
-8
lines changed

7 files changed

+20
-8
lines changed

config-schema.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"logoUrl",
1111
"reconmapApiUrl",
1212
"notificationsServiceUrl",
13+
"integrationsApiUrl",
1314
"keycloak"
1415
],
1516
"properties": {
@@ -31,6 +32,10 @@
3132
"type": "string",
3233
"format": "uri"
3334
},
35+
"integrationsApiUrl": {
36+
"type": "string",
37+
"format": "uri"
38+
},
3439
"keycloak": {
3540
"type": "object",
3641
"required": [

config.local.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"logoUrl": "/logo-name.png",
44
"reconmapApiUrl": "http://localhost:5253/api",
55
"notificationsServiceUrl": "ws://localhost:5253/api",
6+
"integrationsApiUrl": "http://localhost:5510",
67
"keycloak": {
78
"url": "http://localhost:8080",
89
"realm": "reconmap",

packages/app/src/Configuration.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const Configuration = {
55

66
getNotificationsServiceUrl: (): string => window.env.notificationsServiceUrl,
77

8+
getIntegrationsApiUrl: (): string => window.env.integrationsApiUrl,
9+
810
getContextPath: (): string => window.env.contextPath || "/",
911

1012
getLogoUrl: (): string => window.env.logoUrl || "/logo-name.png",

packages/app/src/api/requests/commands.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Configuration from "Configuration.js";
12
import secureApiFetch from "services/api.js";
23
import { requestEntityPost, requestEntityPut } from "utilities/requests.js";
34

@@ -36,7 +37,7 @@ export const requestCommandSchedulePost = (commandId: number, schedule: object)
3637
requestEntityPost(`${API_BASE_URL}/${commandId}/schedules`, schedule);
3738

3839
const requestCommandsOutputParsers = () => {
39-
return secureApiFetch(`${API_BASE_URL}/output-parsers`, { method: "GET" }, "http://localhost:5510");
40+
return secureApiFetch(`${API_BASE_URL}/output-parsers`, { method: "GET" }, Configuration.getIntegrationsApiUrl());
4041
};
4142

4243
const requestCommandDelete = (commandId: number) => {
@@ -65,5 +66,6 @@ export {
6566
requestCommandSchedules,
6667
requestCommandsOutputParsers,
6768
requestCommandUsageDelete,
68-
requestCommandUsages,
69+
requestCommandUsages
6970
};
71+

packages/app/src/api/requests/reports.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import Configuration from "Configuration.js";
12
import secureApiFetch from "services/api.js";
23

34
const requestReports = (params: any) => {
45
return secureApiFetch(
56
"/reports?" + new URLSearchParams(params).toString(),
67
{ method: "GET" },
7-
"http://localhost:5510",
8+
Configuration.getIntegrationsApiUrl(),
89
);
910
};
1011

@@ -19,7 +20,7 @@ const requestReportPost = (params: any) => {
1920
method: "POST",
2021
body: JSON.stringify(params),
2122
},
22-
"http://localhost:5510",
23+
Configuration.getIntegrationsApiUrl(),
2324
);
2425
};
2526

packages/app/src/api/requests/system.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import Configuration from "Configuration.js";
12
import secureApiFetch from "services/api.js";
23

34
const requestExportables = () => {
@@ -31,7 +32,7 @@ const requestCustomFieldDeletion = (customFieldId: number) => {
3132
};
3233

3334
const requestSystemIntegrations = () => {
34-
return secureApiFetch(`/system/integrations`, { method: "GET" }, "http://localhost:5510");
35+
return secureApiFetch(`/system/integrations`, { method: "GET" }, Configuration.getIntegrationsApiUrl());
3536
};
3637

3738
const requestRecentSearches = () => {
@@ -46,5 +47,6 @@ export {
4647
requestRecentSearches,
4748
requestSystemHealth,
4849
requestSystemIntegrations,
49-
requestSystemUsage,
50+
requestSystemUsage
5051
};
52+

packages/app/src/components/projects/Report.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ export default ProjectReport;
4040

4141
const ReportPreview = ({ projectId }) => {
4242
const user = KeyCloakService.getUserInfo();
43-
let apiUrl = Configuration.getDefaultApiUrl();
44-
apiUrl = "http://localhost:5510";
43+
let apiUrl = Configuration.getIntegrationsApiUrl()
4544
return (
4645
<iframe
4746
title="Report preview"

0 commit comments

Comments
 (0)