From bc13cc890398fbce687fe2358a28a028d22a126d Mon Sep 17 00:00:00 2001 From: Rene Evertz Date: Fri, 30 May 2025 10:43:28 +0200 Subject: [PATCH] OpenRouteApiKey ausgezogen --- Host/Web.Secrets.config.template | 3 ++- Host/Web.config | 1 - .../DistanceCalculator/OpenrouteServiceAPI.cs | 15 ++++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Host/Web.Secrets.config.template b/Host/Web.Secrets.config.template index c6d596a1f..1fe58aa0a 100644 --- a/Host/Web.Secrets.config.template +++ b/Host/Web.Secrets.config.template @@ -8,5 +8,6 @@ - + + \ No newline at end of file diff --git a/Host/Web.config b/Host/Web.config index 90b46eb9e..b06514b71 100644 --- a/Host/Web.config +++ b/Host/Web.config @@ -302,7 +302,6 @@ - diff --git a/Service/ServiceUtils/DistanceCalculator/OpenrouteServiceAPI.cs b/Service/ServiceUtils/DistanceCalculator/OpenrouteServiceAPI.cs index 3c55f0025..f57842594 100644 --- a/Service/ServiceUtils/DistanceCalculator/OpenrouteServiceAPI.cs +++ b/Service/ServiceUtils/DistanceCalculator/OpenrouteServiceAPI.cs @@ -1,5 +1,6 @@ using BeWo.Data.Access; using BeWo.Data.Entities; +using BeWo.Service.Core; using Newtonsoft.Json; using System; using System.Collections.Generic; @@ -53,23 +54,23 @@ namespace BeWo.Service.ServiceUtils.DistanceCalculator { var appSettings = ConfigurationManager.AppSettings; - if (string.IsNullOrEmpty(appSettings["OpenrouteServiceApiUrl"])) + Url = appSettings["OpenrouteServiceApiUrl"]; + if (string.IsNullOrEmpty(Url)) { throw new Exception("OpenrouteServiceApiUrl is not set in AppSettings."); } - Url = appSettings["OpenrouteServiceApiUrl"]; - if (string.IsNullOrEmpty(appSettings["OpenrouteServiceApiKey"])) + Key = MergedConfig.GetSecretSetting("OpenrouteServiceApiKey"); + if (string.IsNullOrEmpty(Key)) { throw new Exception("OpenrouteServiceApiKey is not set in AppSettings."); } - Key = appSettings["OpenrouteServiceApiKey"]; - if (string.IsNullOrEmpty(appSettings["OpenrouteServiceApiUrlGeocode"])) + GeoKey = appSettings["OpenrouteServiceApiUrlGeocode"]; + if (string.IsNullOrEmpty(GeoKey)) { throw new Exception("OpenrouteServiceApiUrlGeocode is not set in AppSettings."); - } - GeoKey = appSettings["OpenrouteServiceApiUrlGeocode"]; + } } public void RequestMissingData(ref AddressRouteMatrix matrix, IEnumerable
origins, IEnumerable
destinations)