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