Files
KonSoft.Clean/gateways/KonSoft.InternalGateway/Program.cs
2025-10-19 19:19:58 +08:00

37 lines
992 B
C#

using KonSoft.InternalGateway;
using KonSoft.Shared.Hosting.AspNetCore;
using Serilog;
var assemblyName = typeof(Program).Assembly.GetName().Name!;
SerilogConfigurationHelper.Configure(assemblyName);
try
{
var builder = WebApplication.CreateBuilder(args);
builder.Configuration
.AddAgileConfig(option =>
{
option.ENV = Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Development";
});
builder.Host
.AddAppSettingsSecretsJson()
.UseAutofac()
.UseSerilog();
builder.Services.AddReverseProxy()
.LoadFromConfig(builder.Configuration.GetSection("ReverseProxy"));
await builder.AddApplicationAsync<InternalGatewayModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();
return 0;
}
catch (Exception ex)
{
Log.Fatal(ex, $"{assemblyName} terminated unexpectedly!");
return 1;
}
finally
{
await Log.CloseAndFlushAsync();
}