Refactor runtime bootstrap and ship control flows

This commit is contained in:
2026-04-03 01:12:26 -04:00
parent 0bb72bee35
commit 706e1cda8f
129 changed files with 9588 additions and 3548 deletions

View File

@@ -0,0 +1,33 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
namespace SpaceGame.Api.Auth.Simulation;
public sealed class DevAuthSeeder(
IHostEnvironment hostEnvironment,
IOptions<AuthOptions> authOptions,
IAuthRepository authRepository,
LocalPasswordHasher passwordHasher)
{
public async Task SeedAsync(CancellationToken cancellationToken)
{
if (!hostEnvironment.IsDevelopment())
{
return;
}
foreach (var seedUser in authOptions.Value.DevSeedUsers)
{
if (string.IsNullOrWhiteSpace(seedUser.Email) || string.IsNullOrWhiteSpace(seedUser.Password))
{
continue;
}
await authRepository.UpsertUserAsync(
seedUser.Email.Trim().ToLowerInvariant(),
passwordHasher.HashPassword(seedUser.Password),
seedUser.Roles,
cancellationToken);
}
}
}