diff --git a/service/Service/Program.cs b/service/Service/Program.cs index e8c8b231d..cfff034d5 100644 --- a/service/Service/Program.cs +++ b/service/Service/Program.cs @@ -78,10 +78,8 @@ public static void Main(string[] args) // Some OpenAPI Explorer/Swagger dependencies appBuilder.ConfigureSwagger(config); - // Inject memory client and its dependencies - // Note: pass the current service collection to the builder, in order to start the pipeline handlers - var memoryBuilder = new KernelMemoryBuilder(appBuilder.Services) - .FromAppSettings(); + // Prepare memory instance using configuration settings + var memoryBuilder = new KernelMemoryBuilder(appBuilder.Services).FromAppSettings(); // Build the memory client and make it available for dependency injection appBuilder.Services.AddSingleton(memoryBuilder.Build()); @@ -95,6 +93,10 @@ public static void Main(string[] args) // *************************** START *********************************** var env = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT"); + if (string.IsNullOrEmpty(env)) + { + app.Logger.LogError("ASPNETCORE_ENVIRONMENT env var not defined."); + } Console.WriteLine("***************************************************************************************************************************"); Console.WriteLine($"* Environment : " + (string.IsNullOrEmpty(env) ? "WARNING: ASPNETCORE_ENVIRONMENT env var not defined" : env)); @@ -117,11 +119,6 @@ public static void Main(string[] args) config.ServiceAuthorization.Enabled, config.Service.RunHandlers); - if (string.IsNullOrEmpty(env)) - { - app.Logger.LogError("ASPNETCORE_ENVIRONMENT env var not defined."); - } - app.Run(); } }