using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Mirea.Api.Endpoint.Common.Services.Security; using Mirea.Api.Endpoint.Configuration.Model; using Mirea.Api.Endpoint.Configuration.Model.GeneralSettings; using Mirea.Api.Security; using Mirea.Api.Security.Common.Interfaces; namespace Mirea.Api.Endpoint.Configuration.Core.Startup; public static class SecureConfiguration { public static IServiceCollection AddSecurity(this IServiceCollection services, IConfiguration configuration) { services.AddSecurityServices(configuration); services.AddSingleton(); if (configuration.Get()?.CacheSettings?.TypeDatabase == CacheSettings.CacheEnum.Redis) services.AddSingleton(); else services.AddSingleton(); return services; } }