Skip to content

Commit

Permalink
Update Program.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Snazzie committed Jan 30, 2024
1 parent 49a97e1 commit 3104bae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Source/Topica.Server/Topica.Server/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@

using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
db.Database.EnsureCreated();


var jsonString = await File.ReadAllTextAsync("auth.config.json");
var authConfig = JsonSerializer.Deserialize<AuthConfig>(jsonString) ?? throw new NullReferenceException("Invalid Auth config");

Expand All @@ -99,8 +103,7 @@ await authDb.Users.AddAsync(
}
await authDb.SaveChangesAsync();

var db = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
db.Database.Migrate();

}

app.UseCors(options =>
Expand Down

0 comments on commit 3104bae

Please sign in to comment.