diff --git a/src/ApiGateway/src/Program.cs b/src/ApiGateway/src/Program.cs index b6098a6..0e586e2 100644 --- a/src/ApiGateway/src/Program.cs +++ b/src/ApiGateway/src/Program.cs @@ -10,6 +10,8 @@ var env = builder.Environment; var appOptions = builder.Services.GetOptions("AppOptions"); Console.WriteLine(FiggleFonts.Standard.Render(appOptions.Name)); + + builder.AddCustomSerilog(env); builder.Services.AddJwt(); builder.Services.AddControllers(); diff --git a/src/Services/Booking/src/Booking.Api/Program.cs b/src/Services/Booking/src/Booking.Api/Program.cs index 2b97163..c35afa6 100644 --- a/src/Services/Booking/src/Booking.Api/Program.cs +++ b/src/Services/Booking/src/Booking.Api/Program.cs @@ -3,6 +3,14 @@ using BuildingBlocks.Web; var builder = WebApplication.CreateBuilder(args); +builder.Host.UseDefaultServiceProvider((context, options) => +{ + // Service provider validation + // ref: https://andrewlock.net/new-in-asp-net-core-3-service-provider-validation/ + options.ValidateScopes = context.HostingEnvironment.IsDevelopment() || context.HostingEnvironment.IsStaging() || context.HostingEnvironment.IsEnvironment("tests"); + options.ValidateOnBuild = true; +}); + builder.AddMinimalEndpoints(); builder.AddInfrastructure(); diff --git a/src/Services/Flight/src/Flight.Api/Program.cs b/src/Services/Flight/src/Flight.Api/Program.cs index ae85e47..8ef0777 100644 --- a/src/Services/Flight/src/Flight.Api/Program.cs +++ b/src/Services/Flight/src/Flight.Api/Program.cs @@ -3,6 +3,14 @@ using Flight.Extensions.Infrastructure; var builder = WebApplication.CreateBuilder(args); +builder.Host.UseDefaultServiceProvider((context, options) => +{ + // Service provider validation + // ref: https://andrewlock.net/new-in-asp-net-core-3-service-provider-validation/ + options.ValidateScopes = context.HostingEnvironment.IsDevelopment() || context.HostingEnvironment.IsStaging() || context.HostingEnvironment.IsEnvironment("tests"); + options.ValidateOnBuild = true; +}); + builder.AddMinimalEndpoints(); builder.AddInfrastructure(); diff --git a/src/Services/Identity/src/Identity.Api/Program.cs b/src/Services/Identity/src/Identity.Api/Program.cs index 60930e0..d23adf9 100644 --- a/src/Services/Identity/src/Identity.Api/Program.cs +++ b/src/Services/Identity/src/Identity.Api/Program.cs @@ -3,6 +3,14 @@ using Identity.Extensions.Infrastructure; var builder = WebApplication.CreateBuilder(args); +builder.Host.UseDefaultServiceProvider((context, options) => +{ + // Service provider validation + // ref: https://andrewlock.net/new-in-asp-net-core-3-service-provider-validation/ + options.ValidateScopes = context.HostingEnvironment.IsDevelopment() || context.HostingEnvironment.IsStaging() || context.HostingEnvironment.IsEnvironment("tests"); + options.ValidateOnBuild = true; +}); + builder.AddMinimalEndpoints(); builder.AddInfrastructure(); diff --git a/src/Services/Passenger/src/Passenger.Api/Program.cs b/src/Services/Passenger/src/Passenger.Api/Program.cs index 67a3ae7..0852ae0 100644 --- a/src/Services/Passenger/src/Passenger.Api/Program.cs +++ b/src/Services/Passenger/src/Passenger.Api/Program.cs @@ -3,6 +3,13 @@ using Passenger.Extensions.Infrastructure; var builder = WebApplication.CreateBuilder(args); +builder.Host.UseDefaultServiceProvider((context, options) => +{ + // Service provider validation + // ref: https://andrewlock.net/new-in-asp-net-core-3-service-provider-validation/ + options.ValidateScopes = context.HostingEnvironment.IsDevelopment() || context.HostingEnvironment.IsStaging() || context.HostingEnvironment.IsEnvironment("tests"); + options.ValidateOnBuild = true; +}); builder.AddMinimalEndpoints(); builder.AddInfrastructure();