Skip to content

Commit

Permalink
Update Program.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
dluc authored Feb 20, 2024
1 parent 8a2c25d commit 6d516d7
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions service/Service/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<IKernelMemory>(memoryBuilder.Build());
Expand All @@ -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));
Expand All @@ -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();
}
}

0 comments on commit 6d516d7

Please sign in to comment.