From 57ba948fe6c235851e99f1a7e9d6449a957d0684 Mon Sep 17 00:00:00 2001 From: TekH Date: Tue, 18 Aug 2026 15:49:30 +0200 Subject: [PATCH] Update base path for configuration loading Replaced `Directory.GetCurrentDirectory()` with `AppContext.BaseDirectory` in `Program.cs` to set the base path for configuration loading. This ensures configuration files are loaded relative to the application's runtime location instead of the current working directory. --- .../DigitalData.MessagingService.API/Program.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/presentation/DigitalData.MessagingService.API/Program.cs b/src/presentation/DigitalData.MessagingService.API/Program.cs index 65a1537..e1b85b3 100644 --- a/src/presentation/DigitalData.MessagingService.API/Program.cs +++ b/src/presentation/DigitalData.MessagingService.API/Program.cs @@ -8,10 +8,10 @@ using Serilog.Ui.Web.Extensions; // Build temporary configuration to read log directory early var tempConfig = new ConfigurationBuilder() - .SetBasePath(Directory.GetCurrentDirectory()) - .AddJsonFile("appsettings.json", optional: false, reloadOnChange: false) - .AddJsonFile("appsettings.Secrets.json", optional: true, reloadOnChange: false) - .Build(); +.SetBasePath(AppContext.BaseDirectory) +.AddJsonFile("appsettings.json", optional: false, reloadOnChange: false) +.AddJsonFile("appsettings.Secrets.json", optional: true, reloadOnChange: false) +.Build(); var logDirectoryRaw = tempConfig.GetValue("Application:LogDirectory") ?? "logs"; // Always resolve to an absolute path so sink and UI provider point to the same file