更新 .gitignore 文件以简化敏感数据管理,调整路径以适应项目结构。新增 Entity Framework Core 及相关数据库提供程序的依赖项,增强数据持久化支持。修改 Program.cs 文件以集成平台持久化服务并确保数据库初始化。

This commit is contained in:
ArtoriasWu
2026-06-22 09:29:46 +08:00
parent f4dec3c120
commit 5529883b9c
3 changed files with 14 additions and 6 deletions
+5
View File
@@ -16,6 +16,11 @@
<PackageReference Include="Yarp.ReverseProxy" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.10" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
</ItemGroup>
<ItemGroup>
+3
View File
@@ -6,6 +6,7 @@ using Microsoft.OpenApi.Models;
using MiGu.Server.Auth;
using MiGu.Server.Configs;
using MiGu.Server.Launcher;
using MiGu.Server.Persistence;
using Yarp.ReverseProxy.Transforms;
static string? FindSourceContentRoot(string startDir)
@@ -216,6 +217,7 @@ builder.Services.AddSingleton<ConfigStore>();
builder.Services.AddSingleton<OpsAuditStore>();
// OpsController 真实转发 SimpleLite reflection execute 所需的 HttpClient 工厂。
builder.Services.AddHttpClient();
builder.Services.AddPlatformPersistence(builder.Configuration);
// 会话 N+1(启动反转):把 SimpleLite 子进程拉起器接入 DIAuthController 登录成功后按 LaunchMode 调 MaybeStart。
// 配置段绑定 appsettings.json:SimpleLite,可被环境变量 SIMPLELITE__XXX 覆盖。
@@ -223,6 +225,7 @@ builder.Services.Configure<SimpleLiteOptions>(builder.Configuration.GetSection("
builder.Services.AddSingleton<SimpleLiteLauncher>();
var app = builder.Build();
await app.Services.EnsurePlatformDatabaseAsync();
// 启动期主动构造 JwtIssuer / InternalTokenStore:让 secret 校验日志在请求来之前打印。
_ = app.Services.GetRequiredService<JwtIssuer>();