Made small tweak to startup
This commit is contained in:
parent
0fd20ee962
commit
5397e8d5c8
@ -16,31 +16,21 @@ builder.Services.AddTransient<IIdentityService, IdentityService>();
|
|||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
try
|
if (!await app.CheckHealthAsync())
|
||||||
{
|
{
|
||||||
if (!await app.CheckHealthAsync())
|
return;
|
||||||
{
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
app.UseServiceDefaults();
|
|
||||||
|
|
||||||
app.MapGet("/", () => Results.Redirect("/swagger"));
|
|
||||||
|
|
||||||
app.MapGrpcService<BasketService>();
|
|
||||||
app.MapControllers();
|
|
||||||
|
|
||||||
var eventBus = app.Services.GetRequiredService<IEventBus>();
|
|
||||||
|
|
||||||
eventBus.Subscribe<ProductPriceChangedIntegrationEvent, ProductPriceChangedIntegrationEventHandler>();
|
|
||||||
eventBus.Subscribe<OrderStartedIntegrationEvent, OrderStartedIntegrationEventHandler>();
|
|
||||||
|
|
||||||
await app.RunAsync();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
app.Logger.LogCritical(ex, "Program terminated unexpectedly");
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
app.UseServiceDefaults();
|
||||||
|
|
||||||
|
app.MapGet("/", () => Results.Redirect("/swagger"));
|
||||||
|
|
||||||
|
app.MapGrpcService<BasketService>();
|
||||||
|
app.MapControllers();
|
||||||
|
|
||||||
|
var eventBus = app.Services.GetRequiredService<IEventBus>();
|
||||||
|
|
||||||
|
eventBus.Subscribe<ProductPriceChangedIntegrationEvent, ProductPriceChangedIntegrationEventHandler>();
|
||||||
|
eventBus.Subscribe<OrderStartedIntegrationEvent, OrderStartedIntegrationEventHandler>();
|
||||||
|
|
||||||
|
await app.RunAsync();
|
||||||
|
@ -7,7 +7,7 @@ builder.AddServiceDefaults();
|
|||||||
builder.Services.AddGrpc();
|
builder.Services.AddGrpc();
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
|
|
||||||
// Applcation specific services
|
// Application specific services
|
||||||
builder.Services.AddDbContexts(builder.Configuration);
|
builder.Services.AddDbContexts(builder.Configuration);
|
||||||
builder.Services.AddApplicationOptions(builder.Configuration);
|
builder.Services.AddApplicationOptions(builder.Configuration);
|
||||||
builder.Services.AddHealthChecks(builder.Configuration);
|
builder.Services.AddHealthChecks(builder.Configuration);
|
||||||
@ -18,6 +18,11 @@ builder.Services.AddTransient<OrderStatusChangedToPaidIntegrationEventHandler>()
|
|||||||
|
|
||||||
var app = builder.Build();
|
var app = builder.Build();
|
||||||
|
|
||||||
|
if (!await app.CheckHealthAsync())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
app.UseServiceDefaults();
|
app.UseServiceDefaults();
|
||||||
|
|
||||||
app.UseFileServer(new FileServerOptions
|
app.UseFileServer(new FileServerOptions
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"UseCustomizationData": false,
|
"Logging": {
|
||||||
"AzureServiceBusEnabled": false,
|
"LogLevel": {
|
||||||
"AzureStorageEnabled": false,
|
"Default": "Information",
|
||||||
"ApplicationInsights": {
|
"Microsoft.AspNetCore": "Warning"
|
||||||
"InstrumentationKey": ""
|
}
|
||||||
},
|
},
|
||||||
"OpenApi": {
|
"OpenApi": {
|
||||||
"Endpoint": {
|
"Endpoint": {
|
||||||
@ -22,6 +22,12 @@
|
|||||||
"EventBus": {
|
"EventBus": {
|
||||||
"SubscriptionClientName": "Catalog",
|
"SubscriptionClientName": "Catalog",
|
||||||
"RetryCount": 5
|
"RetryCount": 5
|
||||||
}
|
},
|
||||||
|
"ApplicationInsights": {
|
||||||
|
"InstrumentationKey": ""
|
||||||
|
},
|
||||||
|
"UseCustomizationData": false,
|
||||||
|
"AzureServiceBusEnabled": false,
|
||||||
|
"AzureStorageEnabled": false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user