|
@ -1,8 +1,10 @@ |
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
|
|
|
|
|
using HealthChecks.UI.Client; |
|
|
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
using Microsoft.AspNetCore.Diagnostics.HealthChecks; |
|
|
using Microsoft.AspNetCore.Diagnostics.HealthChecks; |
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.Configuration; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
|
|
using Microsoft.Extensions.Diagnostics.HealthChecks; |
|
|
using Microsoft.Extensions.FileProviders; |
|
|
using Microsoft.Extensions.FileProviders; |
|
|
using Microsoft.Extensions.Logging; |
|
|
using Microsoft.Extensions.Logging; |
|
|
using Ocelot.DependencyInjection; |
|
|
using Ocelot.DependencyInjection; |
|
@ -12,10 +14,8 @@ using OcelotApiGw.Models; |
|
|
using OcelotApiGw.Orchestrators; |
|
|
using OcelotApiGw.Orchestrators; |
|
|
using OcelotApiGw.Providers; |
|
|
using OcelotApiGw.Providers; |
|
|
using OcelotApiGw.Services; |
|
|
using OcelotApiGw.Services; |
|
|
using System.Linq; |
|
|
|
|
|
using System; |
|
|
using System; |
|
|
using HealthChecks.UI.Client; |
|
|
|
|
|
using Microsoft.Extensions.Diagnostics.HealthChecks; |
|
|
|
|
|
|
|
|
using System.Linq; |
|
|
|
|
|
|
|
|
namespace OcelotApiGw |
|
|
namespace OcelotApiGw |
|
|
{ |
|
|
{ |
|
@ -35,13 +35,13 @@ namespace OcelotApiGw |
|
|
|
|
|
|
|
|
services.AddHealthChecks() |
|
|
services.AddHealthChecks() |
|
|
.AddCheck("self", () => HealthCheckResult.Healthy()) |
|
|
.AddCheck("self", () => HealthCheckResult.Healthy()) |
|
|
.AddUrlGroup(new Uri(_cfg["CatalogUrlHC"]), name: "catalogapi-check", tags: new string[] { "catalogapi" }) |
|
|
|
|
|
.AddUrlGroup(new Uri(_cfg["OrderingUrlHC"]), name: "orderingapi-check", tags: new string[] { "orderingapi" }) |
|
|
|
|
|
.AddUrlGroup(new Uri(_cfg["BasketUrlHC"]), name: "basketapi-check", tags: new string[] { "basketapi" }) |
|
|
|
|
|
.AddUrlGroup(new Uri(_cfg["IdentityUrlHC"]), name: "identityapi-check", tags: new string[] { "identityapi" }) |
|
|
|
|
|
.AddUrlGroup(new Uri(_cfg["MarketingUrlHC"]), name: "marketingapi-check", tags: new string[] { "marketingapi" }) |
|
|
|
|
|
.AddUrlGroup(new Uri(_cfg["PaymentUrlHC"]), name: "paymentapi-check", tags: new string[] { "paymentapi" }) |
|
|
|
|
|
.AddUrlGroup(new Uri(_cfg["LocationUrlHC"]), name: "locationapi-check", tags: new string[] { "locationapi" }); |
|
|
|
|
|
|
|
|
.AddUrlGroup(new Uri(_configuration["CatalogUrlHC"]), name: "catalogapi-check", tags: new string[] { "catalogapi" }) |
|
|
|
|
|
.AddUrlGroup(new Uri(_configuration["OrderingUrlHC"]), name: "orderingapi-check", tags: new string[] { "orderingapi" }) |
|
|
|
|
|
.AddUrlGroup(new Uri(_configuration["BasketUrlHC"]), name: "basketapi-check", tags: new string[] { "basketapi" }) |
|
|
|
|
|
.AddUrlGroup(new Uri(_configuration["IdentityUrlHC"]), name: "identityapi-check", tags: new string[] { "identityapi" }) |
|
|
|
|
|
.AddUrlGroup(new Uri(_configuration["MarketingUrlHC"]), name: "marketingapi-check", tags: new string[] { "marketingapi" }) |
|
|
|
|
|
.AddUrlGroup(new Uri(_configuration["PaymentUrlHC"]), name: "paymentapi-check", tags: new string[] { "paymentapi" }) |
|
|
|
|
|
.AddUrlGroup(new Uri(_configuration["LocationUrlHC"]), name: "locationapi-check", tags: new string[] { "locationapi" }); |
|
|
|
|
|
|
|
|
services.AddCors(options => |
|
|
services.AddCors(options => |
|
|
{ |
|
|
{ |
|
@ -107,9 +107,9 @@ namespace OcelotApiGw |
|
|
Predicate = r => r.Name.Contains("self") |
|
|
Predicate = r => r.Name.Contains("self") |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
loggerFactory.AddConsole(_cfg.GetSection("Logging")); |
|
|
|
|
|
|
|
|
|
|
|
app.UseCors("CorsPolicy"); |
|
|
|
|
|
|
|
|
#pragma warning disable CS0618 // Type or member is obsolete
|
|
|
|
|
|
loggerFactory.AddConsole(_configuration.GetSection("Logging")); |
|
|
|
|
|
#pragma warning restore CS0618 // Type or member is obsolete
|
|
|
|
|
|
|
|
|
app.UseCors("CorsPolicy") |
|
|
app.UseCors("CorsPolicy") |
|
|
.UseOcelot() |
|
|
.UseOcelot() |
|
|