61 lines
2.1 KiB
C#
61 lines
2.1 KiB
C#
using LiteCharms.Features.Mediator;
|
|
using LiteCharms.Features.MidrandBooks.Payments;
|
|
using LiteCharms.Features.Extensions;
|
|
using LiteCharms.Features.MidrandBooks.Extensions;
|
|
using static LiteCharms.Features.Extensions.Quartz;
|
|
|
|
namespace MidrandBookshop;
|
|
|
|
public static class Setup
|
|
{
|
|
public static IServiceCollection RegisterServices(this IServiceCollection services, IConfiguration configuration)
|
|
{
|
|
services.AddCancellationToken();
|
|
services.AddAntiforgery();
|
|
|
|
services.AddRazorComponents()
|
|
.AddInteractiveServerComponents();
|
|
|
|
services.AddEndpointsApiExplorer();
|
|
|
|
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TelemetryPipelineBehavior<,>));
|
|
services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingPipelineBehavior<,>));
|
|
|
|
services.AddQuartzSchedulerClient(MidrandShopSchedulerName, configuration);
|
|
|
|
services.AddMediator();
|
|
services.AddEmailServices(configuration);
|
|
services.AddEmailServiceBus();
|
|
|
|
services.AddHttpClient();
|
|
services.AddScoped<CartService>();
|
|
services.AddScoped<HydrationService>();
|
|
services.AddShopServices(includeLocalStorage: true);
|
|
services.AddHashServices(configuration);
|
|
services.AddPayfastServices(configuration);
|
|
|
|
services.AddDataProtectionDatabase(configuration);
|
|
services.AddMidrandShopDatabase(configuration);
|
|
|
|
services.AddSecurityApiSdk(configuration);
|
|
services.AddLiteCharmsWebSecurity(configuration);
|
|
|
|
services.AddMidrandShopPostgresHealthCheck();
|
|
services.AddMidrandShopQuartzHealthCheck();
|
|
services.AddHealthChecksSupport(configuration);
|
|
|
|
services.Configure<ForwardedHeadersOptions>(options =>
|
|
{
|
|
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
|
|
|
|
options.KnownProxies.Clear();
|
|
options.KnownIPNetworks.Clear();
|
|
|
|
options.ForwardLimit = null;
|
|
options.RequireHeaderSymmetry = false;
|
|
});
|
|
|
|
return services;
|
|
}
|
|
}
|