diff options
| author | Melodi <62381002+Melodi17@users.noreply.github.com> | 2026-09-03 23:06:05 +1000 |
|---|---|---|
| committer | Melodi <62381002+Melodi17@users.noreply.github.com> | 2026-09-03 23:06:05 +1000 |
| commit | 7c33b3f334cf91918add7af08866f2ea37ed9c3f (patch) | |
| tree | 8095a2d65e87a808fac62b47e315a4875cc86b73 /src/marlin.web/Program.cs | |
chore: initial commit
Diffstat (limited to 'src/marlin.web/Program.cs')
| -rw-r--r-- | src/marlin.web/Program.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/src/marlin.web/Program.cs b/src/marlin.web/Program.cs new file mode 100644 index 0000000..cf330b2 --- /dev/null +++ b/src/marlin.web/Program.cs @@ -0,0 +1,42 @@ +using marlin.web.Data; +using marlin.web.Services; +using Microsoft.EntityFrameworkCore; + +DotNetEnv.Env.NoClobber().TraversePath().Load(); + +var builder = WebApplication.CreateBuilder(args); + +builder.Services.AddDbContext<ApplicationDbContext>(options => options + .UseNpgsql(builder.Configuration.GetConnectionString("Master")) + .UseSnakeCaseNamingConvention()); + +builder.Services.AddHostedService<DatabaseUpgrader>(); +builder.Services.AddHostedService<VersionControlSyncService>(); + +// Add services to the container. +builder.Services.AddControllersWithViews(); + +var app = builder.Build(); + +// Configure the HTTP request pipeline. +if (!app.Environment.IsDevelopment()) +{ + app.UseExceptionHandler("/Home/Error"); + // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. + app.UseHsts(); +} + +app.UseHttpsRedirection(); +app.UseRouting(); + +app.UseAuthorization(); + +app.MapStaticAssets(); + +app + .MapControllerRoute( + name: "default", + pattern: "{controller=Home}/{action=Index}/{id?}") + .WithStaticAssets(); + +app.Run();
\ No newline at end of file |
