StatusService Aktivierung

This commit is contained in:
2026-05-07 11:37:48 +02:00
parent bb4ca9c104
commit 1511f91d5b
4 changed files with 12 additions and 1 deletions

View File

@@ -13,4 +13,5 @@
<add key="OpenrouteServiceApiKey" value="" />
<add key="GoogleDistanceMatrixApiKey" value="" />
<add key="GkvSecretKey" value="" />
<add key="AppStatusApiKey" value="" />
</appSettings>

View File

@@ -30,6 +30,7 @@ namespace BeWo.Service
OpenrouteServiceApiKey,
GoogleDistanceMatrixApiKey,
GkvSecretKey,
AppStatusApiKey
}
[DefaultValue(None)]

View File

@@ -15,6 +15,7 @@ namespace BeWo.Service.ServiceContracts.Enhanced
{
[OperationContract]
[WebGet(UriTemplate = "/Status", ResponseFormat = WebMessageFormat.Json)]
[RequireApiAuthorization(ApiKeyName = WebSecretConfigSetting.AppStatusApiKey)]
ServerStatusDC GetStatus();
}
}

View File

@@ -8,6 +8,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.ServiceModel;
using System.ServiceModel.Web;
@@ -38,6 +39,13 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
result.Services.Add(CheckService("AIModule", CheckAiModule()));
result.Services.Add(CheckService("Web.config", CheckWebConfig()));
var allHealthy = result.DatabaseOk && result.Services.All(x => x.IsOk);
if (!allHealthy)
{
WebOperationContext.Current.OutgoingResponse.StatusCode =
HttpStatusCode.InternalServerError;
}
return result;
}
@@ -98,7 +106,7 @@ namespace BeWo.Service.ServiceImplementations.Enhanced
{
// #1
var url = MergedConfig.GetSetting(WebConfigSetting.AiPromptsUrl);
if (!string.IsNullOrWhiteSpace(url))
if (string.IsNullOrWhiteSpace(url))
return "AiPromptsUrl wurde nicht korrekt konfiguriert";
return null;