2024-06-14 11:09:53 +00:00
|
|
|
import URL from "Common/Types/API/URL";
|
|
|
|
import ObjectID from "Common/Types/ObjectID";
|
|
|
|
import logger from "CommonServer/Utils/Logger";
|
2023-05-03 10:54:25 +00:00
|
|
|
|
2024-06-14 11:09:53 +00:00
|
|
|
if (!process.env["INGESTOR_URL"] && !process.env["ONEUPTIME_URL"]) {
|
|
|
|
logger.error("INGESTOR_URL or ONEUPTIME_URL is not set");
|
|
|
|
process.exit();
|
2023-05-03 10:54:25 +00:00
|
|
|
}
|
|
|
|
|
2023-10-14 11:01:06 +00:00
|
|
|
export let INGESTOR_URL: URL = URL.fromString(
|
2024-06-14 11:09:53 +00:00
|
|
|
process.env["ONEUPTIME_URL"] ||
|
|
|
|
process.env["INGESTOR_URL"] ||
|
|
|
|
"https://oneuptime.com",
|
2023-10-14 11:01:06 +00:00
|
|
|
);
|
2023-09-22 15:36:04 +00:00
|
|
|
|
|
|
|
// If probe api does not have the path. Add it.
|
|
|
|
if (
|
2024-06-14 11:09:53 +00:00
|
|
|
!INGESTOR_URL.toString().endsWith("ingestor") &&
|
|
|
|
!INGESTOR_URL.toString().endsWith("ingestor/")
|
2023-09-22 15:36:04 +00:00
|
|
|
) {
|
2024-06-14 11:09:53 +00:00
|
|
|
INGESTOR_URL = URL.fromString(INGESTOR_URL.addRoute("/ingestor").toString());
|
2023-09-22 15:36:04 +00:00
|
|
|
}
|
2023-05-03 10:54:25 +00:00
|
|
|
|
2024-06-14 11:09:53 +00:00
|
|
|
export const PROBE_NAME: string | null = process.env["PROBE_NAME"] || null;
|
2023-05-03 10:54:25 +00:00
|
|
|
|
2023-05-05 12:02:23 +00:00
|
|
|
export const PROBE_DESCRIPTION: string | null =
|
2024-06-14 11:09:53 +00:00
|
|
|
process.env["PROBE_DESCRIPTION"] || null;
|
2023-05-03 10:54:25 +00:00
|
|
|
|
2024-06-14 11:09:53 +00:00
|
|
|
export const PROBE_ID: ObjectID | null = process.env["PROBE_ID"]
|
|
|
|
? new ObjectID(process.env["PROBE_ID"])
|
|
|
|
: null;
|
2023-05-03 10:54:25 +00:00
|
|
|
|
2024-06-14 11:09:53 +00:00
|
|
|
if (!process.env["PROBE_KEY"]) {
|
|
|
|
logger.error("PROBE_KEY is not set");
|
|
|
|
process.exit();
|
2023-05-03 10:54:25 +00:00
|
|
|
}
|
|
|
|
|
2024-06-14 11:09:53 +00:00
|
|
|
export const PROBE_KEY: string = process.env["PROBE_KEY"];
|
2023-08-06 20:54:12 +00:00
|
|
|
|
|
|
|
let probeMonitoringWorkers: string | number =
|
2024-06-14 11:09:53 +00:00
|
|
|
process.env["PROBE_MONITORING_WORKERS"] || 1;
|
2023-08-06 20:54:12 +00:00
|
|
|
|
2024-06-14 11:09:53 +00:00
|
|
|
if (typeof probeMonitoringWorkers === "string") {
|
|
|
|
probeMonitoringWorkers = parseInt(probeMonitoringWorkers);
|
2023-08-06 20:54:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const PROBE_MONITORING_WORKERS: number = probeMonitoringWorkers;
|
2023-08-07 14:22:45 +00:00
|
|
|
|
|
|
|
let monitorFetchLimit: string | number =
|
2024-07-04 20:05:03 +00:00
|
|
|
process.env["PROBE_MONITOR_FETCH_LIMIT"] || 10;
|
2023-08-07 14:22:45 +00:00
|
|
|
|
2024-06-14 11:09:53 +00:00
|
|
|
if (typeof monitorFetchLimit === "string") {
|
|
|
|
monitorFetchLimit = parseInt(monitorFetchLimit);
|
2023-08-07 14:22:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const PROBE_MONITOR_FETCH_LIMIT: number = monitorFetchLimit;
|
2024-03-29 16:47:56 +00:00
|
|
|
|
2024-06-14 11:09:53 +00:00
|
|
|
export const HOSTNAME: string = process.env["HOSTNAME"] || "localhost";
|
2024-05-22 19:06:32 +00:00
|
|
|
|
|
|
|
export const PROBE_SYNTHETIC_MONITOR_SCRIPT_TIMEOUT_IN_MS: number = process.env[
|
2024-06-14 11:09:53 +00:00
|
|
|
"PROBE_SYNTHETIC_MONITOR_SCRIPT_TIMEOUT_IN_MS"
|
2024-05-22 19:06:32 +00:00
|
|
|
]
|
2024-06-14 11:09:53 +00:00
|
|
|
? parseInt(
|
|
|
|
process.env["PROBE_SYNTHETIC_MONITOR_SCRIPT_TIMEOUT_IN_MS"].toString(),
|
|
|
|
)
|
|
|
|
: 60000;
|
2024-05-22 19:06:32 +00:00
|
|
|
|
|
|
|
export const PROBE_CUSTOM_CODE_MONITOR_SCRIPT_TIMEOUT_IN_MS: number = process
|
2024-06-14 11:09:53 +00:00
|
|
|
.env["PROBE_CUSTOM_CODE_MONITOR_SCRIPT_TIMEOUT_IN_MS"]
|
|
|
|
? parseInt(
|
|
|
|
process.env["PROBE_CUSTOM_CODE_MONITOR_SCRIPT_TIMEOUT_IN_MS"].toString(),
|
|
|
|
)
|
|
|
|
: 60000;
|