using LinqToDB.Data; using Microsoft.AspNetCore.StaticFiles; using zotanpw.Backend; using zotanpw.Backend.database; DataConnection.DefaultSettings = new Database.Settings(); Migrations.RunMigrations(); var builder = WebApplication.CreateBuilder(args); builder.Services.AddRazorPages(); builder.Services.AddSession(options => { options.IdleTimeout = TimeSpan.MaxValue; options.Cookie.HttpOnly = true; options.Cookie.IsEssential = true; }); #if (DEBUG) builder.Services.AddControllers().AddRazorRuntimeCompilation(); builder.Services.AddControllers(); #else builder.Services.AddControllers(); #endif var app = builder.Build(); if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/error"); app.UseHsts(); } var provider = new FileExtensionContentTypeProvider { Mappings = { [".gpg"] = "application/pgp-signature" } }; app.UseStaticFiles(new StaticFileOptions { ContentTypeProvider = provider }); app.UseSession(); app.UseRouting(); app.UseAuthorization(); app.MapRazorPages(); app.MapControllers(); app.Run();