mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-01-16 23:00:51 +00:00
Refactor StatusPage API integration to use internal URL for server-to-server communication
This commit is contained in:
parent
a08700e9f5
commit
8826635920
3 changed files with 13 additions and 6 deletions
|
|
@ -397,6 +397,13 @@ export const StatusPageApiClientUrl: URL = new URL(
|
|||
new Route(StatusPageApiRoute.toString()),
|
||||
);
|
||||
|
||||
// Internal URL for server-to-server communication (uses internal Docker hostname)
|
||||
export const StatusPageApiInternalUrl: URL = new URL(
|
||||
Protocol.HTTP,
|
||||
AppApiHostname.toString(),
|
||||
new Route(StatusPageApiRoute.toString()),
|
||||
);
|
||||
|
||||
export const DashboardClientUrl: URL = new URL(
|
||||
HttpProtocol,
|
||||
Host,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ import { ExpressRequest, ExpressResponse } from "Common/Server/Utils/Express";
|
|||
import API from "Common/Utils/API";
|
||||
import {
|
||||
HttpProtocol,
|
||||
StatusPageApiClientUrl,
|
||||
StatusPageApiInternalUrl,
|
||||
} from "Common/Server/EnvironmentConfig";
|
||||
import URL from "Common/Types/API/URL";
|
||||
import HTTPErrorResponse from "Common/Types/API/HTTPErrorResponse";
|
||||
|
|
@ -39,7 +39,7 @@ export const handleRSS: (
|
|||
// Fetch incidents
|
||||
const incidentsResponse: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
||||
await API.post({
|
||||
url: URL.fromString(StatusPageApiClientUrl.toString()).addRoute(
|
||||
url: URL.fromString(StatusPageApiInternalUrl.toString()).addRoute(
|
||||
`/incidents/${statusPageId}`,
|
||||
),
|
||||
data: {},
|
||||
|
|
@ -51,7 +51,7 @@ export const handleRSS: (
|
|||
// Fetch announcements
|
||||
const announcementsResponse: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
||||
await API.post({
|
||||
url: URL.fromString(StatusPageApiClientUrl.toString()).addRoute(
|
||||
url: URL.fromString(StatusPageApiInternalUrl.toString()).addRoute(
|
||||
`/announcements/${statusPageId}`,
|
||||
),
|
||||
data: {},
|
||||
|
|
@ -63,7 +63,7 @@ export const handleRSS: (
|
|||
// Fetch scheduled maintenance
|
||||
const scheduledResponse: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
||||
await API.post({
|
||||
url: URL.fromString(StatusPageApiClientUrl.toString()).addRoute(
|
||||
url: URL.fromString(StatusPageApiInternalUrl.toString()).addRoute(
|
||||
`/scheduled-maintenance-events/${statusPageId}`,
|
||||
),
|
||||
data: {},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import { ExpressRequest } from "Common/Server/Utils/Express";
|
||||
import API from "Common/Utils/API";
|
||||
import { StatusPageApiClientUrl } from "Common/Server/EnvironmentConfig";
|
||||
import { StatusPageApiInternalUrl } from "Common/Server/EnvironmentConfig";
|
||||
import URL from "Common/Types/API/URL";
|
||||
import HTTPErrorResponse from "Common/Types/API/HTTPErrorResponse";
|
||||
import HTTPResponse from "Common/Types/API/HTTPResponse";
|
||||
|
|
@ -65,7 +65,7 @@ export const getStatusPageData: (
|
|||
);
|
||||
const response: HTTPErrorResponse | HTTPResponse<JSONObject> =
|
||||
await API.get({
|
||||
url: URL.fromString(StatusPageApiClientUrl.toString()).addRoute(
|
||||
url: URL.fromString(StatusPageApiInternalUrl.toString()).addRoute(
|
||||
`/seo/${statusPageIdOrDomain}`,
|
||||
),
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue