del: remove unused health check API
This commit is contained in:
@@ -25,4 +25,4 @@ NEXT_PUBLIC_USE_MOCKS=true
|
|||||||
NEXT_PUBLIC_BASE_PATH=/talas5
|
NEXT_PUBLIC_BASE_PATH=/talas5
|
||||||
# Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH=
|
# Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH=
|
||||||
# App-Versionsnummer
|
# App-Versionsnummer
|
||||||
NEXT_PUBLIC_APP_VERSION=1.1.313
|
NEXT_PUBLIC_APP_VERSION=1.1.314
|
||||||
|
|||||||
@@ -26,4 +26,4 @@ NEXT_PUBLIC_BASE_PATH=/talas5
|
|||||||
# Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH=
|
# Oder leer lassen für direkten Zugriff -> NEXT_PUBLIC_BASE_PATH=
|
||||||
|
|
||||||
# App-Versionsnummer
|
# App-Versionsnummer
|
||||||
NEXT_PUBLIC_APP_VERSION=1.1.313
|
NEXT_PUBLIC_APP_VERSION=1.1.314
|
||||||
|
|||||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.313",
|
"version": "1.1.314",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.313",
|
"version": "1.1.314",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nodemap",
|
"name": "nodemap",
|
||||||
"version": "1.1.313",
|
"version": "1.1.314",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "^11.13.3",
|
"@emotion/react": "^11.13.3",
|
||||||
"@emotion/styled": "^11.13.0",
|
"@emotion/styled": "^11.13.0",
|
||||||
|
|||||||
@@ -1,133 +0,0 @@
|
|||||||
// /pages/api/health.js
|
|
||||||
export default async function handler(req, res) {
|
|
||||||
const basePath = "talas5";
|
|
||||||
const protocol = "http";
|
|
||||||
const hostname = "10.10.0.70";
|
|
||||||
const port = "80";
|
|
||||||
const idMap = "12";
|
|
||||||
const idUser = "484";
|
|
||||||
const idLD = "50922";
|
|
||||||
|
|
||||||
const buildUrl = method =>
|
|
||||||
`${protocol}://${hostname}:${port}/${basePath}/ClientData/WebServiceMap.asmx/${method}?idMap=${idMap}&idUser=${idUser}`;
|
|
||||||
|
|
||||||
const externalUrls = {
|
|
||||||
GisStationsStaticDistrict: buildUrl("GisStationsStaticDistrict"),
|
|
||||||
GisLinesStatus: `${protocol}://${hostname}:${port}/${basePath}/ClientData/WebServiceMap.asmx/GisLinesStatus?idMap=${idMap}`,
|
|
||||||
GisStationsMeasurements: buildUrl("GisStationsMeasurements"),
|
|
||||||
GisStationsStatusDistrict: buildUrl("GisStationsStatusDistrict"),
|
|
||||||
GisSystemStatic: buildUrl("GisSystemStatic"),
|
|
||||||
};
|
|
||||||
|
|
||||||
const internalApiBase = "http://localhost:3000";
|
|
||||||
|
|
||||||
const internalApis = {
|
|
||||||
//area
|
|
||||||
readArea: `${internalApiBase}/api/talas_v5_DB/area/readArea?m=${idMap}`,
|
|
||||||
//device
|
|
||||||
getAllStationsNames: `${internalApiBase}/api/talas_v5_DB/device/getAllStationsNames`,
|
|
||||||
getDevices: `${internalApiBase}/api/talas_v5_DB/device/getDevices`,
|
|
||||||
//gisLines
|
|
||||||
readGisLines: `${internalApiBase}/api/talas_v5_DB/gisLines/readGisLines`,
|
|
||||||
//locationDevice
|
|
||||||
getDeviceId: `${internalApiBase}/api/talas_v5_DB/locationDevice/getDeviceId`,
|
|
||||||
locationDeviceNameById: `${internalApiBase}/api/talas_v5_DB/locationDevice/locationDeviceNameById?idLD=${idLD}`,
|
|
||||||
locationDevices: `${internalApiBase}/api/talas_v5_DB/locationDevice/locationDevices`,
|
|
||||||
//pois
|
|
||||||
addPoi: `${internalApiBase}/api/talas_v5_DB/pois/addPoi`,
|
|
||||||
deletePoi: `${internalApiBase}/api/talas_v5_DB/pois/deletePoi`,
|
|
||||||
getPoiById: `${internalApiBase}/api/talas_v5_DB/pois/getPoiById`,
|
|
||||||
poiIcons: `${internalApiBase}/api/talas_v5_DB/pois/poi-icons`,
|
|
||||||
readAllPOIs: `${internalApiBase}/api/talas_v5_DB/pois/readAllPOIs`,
|
|
||||||
updateLocation: `${internalApiBase}/api/talas_v5_DB/pois/updateLocation`,
|
|
||||||
updatePoi: `${internalApiBase}/api/talas_v5_DB/pois/updatePoi`,
|
|
||||||
//poiTyp
|
|
||||||
readPoiTyp: `${internalApiBase}/api/talas_v5_DB/poiTyp/readPoiTyp`,
|
|
||||||
//station
|
|
||||||
getAllStationsNames: `${internalApiBase}/api/talas_v5_DB/station/getAllStationsNames`,
|
|
||||||
getDevices: `${internalApiBase}/api/talas_v5_DB/station/getDevices`,
|
|
||||||
//
|
|
||||||
priorityConfig: `${internalApiBase}/api/talas_v5_DB/priorityConfig`,
|
|
||||||
};
|
|
||||||
|
|
||||||
const results = {};
|
|
||||||
|
|
||||||
// Prüfe externe Webservices
|
|
||||||
await Promise.all(
|
|
||||||
Object.entries(externalUrls).map(async ([name, url]) => {
|
|
||||||
try {
|
|
||||||
const response = await fetch(url);
|
|
||||||
results[name] = {
|
|
||||||
ok: response.ok,
|
|
||||||
status: response.status,
|
|
||||||
url,
|
|
||||||
};
|
|
||||||
|
|
||||||
if (name === "GisSystemStatic" && response.ok) {
|
|
||||||
const data = await response.json();
|
|
||||||
results["UserRights"] = {
|
|
||||||
ok: Array.isArray(data.Rights),
|
|
||||||
length: data.Rights?.length || 0,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
results[name] = {
|
|
||||||
ok: false,
|
|
||||||
error: error.message,
|
|
||||||
url,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Prüfe interne API-Routen
|
|
||||||
await Promise.all(
|
|
||||||
Object.entries(internalApis).map(async ([name, url]) => {
|
|
||||||
try {
|
|
||||||
const response = await fetch(url);
|
|
||||||
results[`API_${name}`] = {
|
|
||||||
ok: response.ok,
|
|
||||||
status: response.status,
|
|
||||||
url,
|
|
||||||
};
|
|
||||||
} catch (error) {
|
|
||||||
results[`API_${name}`] = {
|
|
||||||
ok: false,
|
|
||||||
error: error.message,
|
|
||||||
url,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
// Prüfe Mock-Status
|
|
||||||
const useMocksEnv = process.env.NEXT_PUBLIC_USE_MOCKS;
|
|
||||||
results["MockMode"] = {
|
|
||||||
expected: "false",
|
|
||||||
actual: useMocksEnv,
|
|
||||||
ok: useMocksEnv === "false",
|
|
||||||
info:
|
|
||||||
useMocksEnv === "false"
|
|
||||||
? "✅ Mockdaten deaktiviert – Live-Daten aktiv."
|
|
||||||
: "⚠️ Mockdaten aktiv – nicht für Produktion geeignet!",
|
|
||||||
};
|
|
||||||
|
|
||||||
// Prüfe Konfiguration der .env.production
|
|
||||||
results["envConfig"] = {
|
|
||||||
NODE_ENV: process.env.NODE_ENV || "undefined",
|
|
||||||
DB_HOST: process.env.DB_HOST || "❌ fehlt",
|
|
||||||
NEXT_PUBLIC_USE_MOCKS: useMocksEnv || "❌ fehlt",
|
|
||||||
status:
|
|
||||||
process.env.NODE_ENV === "production" && useMocksEnv === "false" && process.env.DB_HOST
|
|
||||||
? "✅ .env.production scheint korrekt."
|
|
||||||
: "⚠️ Bitte .env.production prüfen – möglicherweise fehlt etwas.",
|
|
||||||
};
|
|
||||||
|
|
||||||
const allOk = Object.values(results).every(r => r.ok);
|
|
||||||
|
|
||||||
res.status(allOk ? 200 : 207).json({
|
|
||||||
status: allOk ? "ok" : "partial",
|
|
||||||
version: "1.0.0",
|
|
||||||
services: results,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user