adminUI
This commit is contained in:
+15
@@ -4,6 +4,7 @@ using maintenance.Authentication.Core;
|
||||
using maintenance.Authentication.Providers.AdfsWsFed;
|
||||
using maintenance.Authentication.Providers.Oidc;
|
||||
using maintenance.Data;
|
||||
using maintenance.Data.Seed;
|
||||
using maintenance.Services.Templates;
|
||||
using Microsoft.AspNetCore.Authentication;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
@@ -97,6 +98,20 @@ builder.Services.AddAuthorization(options =>
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
if (app.Environment.IsDevelopment())
|
||||
{
|
||||
using var scope = app.Services.CreateScope();
|
||||
var db = scope.ServiceProvider.GetRequiredService<AppDbContext>();
|
||||
try
|
||||
{
|
||||
await TemplateSeeder.SeedAsync(db);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// Seed is best-effort for offline/dev environments.
|
||||
}
|
||||
}
|
||||
|
||||
if (!app.Environment.IsDevelopment())
|
||||
{
|
||||
app.UseExceptionHandler("/Error");
|
||||
|
||||
Reference in New Issue
Block a user