diff --git a/CrystalConnector/CrystalService.cs b/CrystalConnector/CrystalService.cs index edeb159..ba9f5ee 100644 --- a/CrystalConnector/CrystalService.cs +++ b/CrystalConnector/CrystalService.cs @@ -32,6 +32,8 @@ public class CrystalService : IHostedService private void OnStopped() { + Logger.LogInformation("Goodbye!"); + LogManager.Shutdown(); } public Task StartAsync(CancellationToken cancellationToken) @@ -41,8 +43,6 @@ public class CrystalService : IHostedService public Task StopAsync(CancellationToken cancellationToken) { - LogManager.Shutdown(); - return Task.CompletedTask; } } \ No newline at end of file diff --git a/CrystalConnector/Program.cs b/CrystalConnector/Program.cs index b16dc49..544427f 100644 --- a/CrystalConnector/Program.cs +++ b/CrystalConnector/Program.cs @@ -10,11 +10,10 @@ var builder = Host.CreateApplicationBuilder(args); builder.Services.AddHostedService(); -// builder.Services.AddSingleton(); - builder.Environment.ContentRootPath = Directory.GetCurrentDirectory(); + builder.Configuration.AddJsonFile("config.json", true) - .AddJsonFile($"config.{builder.Environment.EnvironmentName}.json") + .AddJsonFile($"config.{builder.Environment.EnvironmentName}.json", true) .AddEnvironmentVariables(prefix: "CRYSTAL_") .AddCommandLine(args);