in src/Unosquare.PassCore.Web/Startup.cs [54:86]
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseStartup<Startup>();
/// <summary>
/// This method gets called by the runtime. Use this method to add services to the container.
/// All arguments are provided through dependency injection.
/// </summary>
/// <param name="services">The services.</param>
public void ConfigureServices(IServiceCollection services)
{
services.Configure<ClientSettings>(Configuration.GetSection(nameof(ClientSettings)));
services.Configure<WebSettings>(Configuration.GetSection(nameof(WebSettings)));
#if DEBUG
services.Configure<IAppSettings>(Configuration.GetSection(AppSettingsSectionName));
services.AddSingleton<IPasswordChangeProvider, DebugPasswordChangeProvider>();
#elif PASSCORE_LDAP_PROVIDER
services.Configure<LdapPasswordChangeOptions>(Configuration.GetSection(AppSettingsSectionName));
services.AddSingleton<IPasswordChangeProvider, LdapPasswordChangeProvider>();
services.AddSingleton<ILoggerFactory, LoggerFactory>();
services.AddSingleton(typeof(ILogger), sp =>
{
var loggerFactory = sp.GetService<ILoggerFactory>();
return loggerFactory.CreateLogger("PassCoreLDAPProvider");
});
#else
services.Configure<PasswordChangeOptions>(Configuration.GetSection(AppSettingsSectionName));
services.AddSingleton<IPasswordChangeProvider, PasswordChangeProvider>();
#endif
// Add framework services.
services.AddControllers();
}