using InkForge.Api.Data; using Microsoft.AspNetCore.Identity; using Microsoft.EntityFrameworkCore; var builder = WebApplication.CreateBuilder(args); // Add services to the container. builder.Services.AddHttpClient(); builder.Services.AddIdentityApiEndpoints() .AddEntityFrameworkStores() .AddDefaultUI().AddDefaultTokenProviders(); var provider = builder.Configuration.GetValue("DbProvider"); builder.Services.AddDbContext(options => _ = provider switch { "Sqlite" => options.UseSqlite( builder.Configuration.GetConnectionString("AuthDb"), x => x.MigrationsAssembly("InkForge.Api.Sqlite") ), _ => throw new Exception($"Invalid Provider: {provider}") }); builder.Services.AddControllers(); // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseRouting(); app.UseAuthentication(); app.UseAuthorization(); app.MapIdentityApi(); app.MapControllers(); app.MapRazorPages(); app.Run();