using Bibblan.Business.Services; using Bibblan.Models; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Options; var builder = WebApplication.CreateBuilder(args); builder.Configuration.AddJsonFile($"appsettings.user.json", true, true); var configSection = builder.Configuration.GetSection(BibblanOptions.Bibblan); BibblanOptions config = new(); configSection.Bind(config); // Add services to the container. builder.Services.Configure(configSection); builder.Services.AddScoped(); builder.Services.AddControllers(); // Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi builder.Services.AddOpenApi(); builder.Services.AddDbContext(options => options.UseSqlite($"Data Source={config.CalibreDb};Mode=ReadOnly;")); builder.Services.AddDbContext(options => options.UseNpgsql(config.BibblanConnection)); var app = builder.Build(); app.UseDefaultFiles(); app.MapStaticAssets(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.MapOpenApi(); } app.UseHttpsRedirection(); app.UseAuthorization(); app.MapControllers(); app.MapFallbackToFile("/index.html"); app.Run();