b875538bb5
- MigrationRunner 구현 (자동 DB 마이그레이션) - Program.cs에 마이그레이션 자동 실행 추가 - 마이그레이션 SQL 파일을 임베드 리소스로 설정 - 완전한 배포 가이드 작성 (DEPLOYMENT_GUIDE.md) - E2E 테스트 절차 포함 - 롤백 및 모니터링 가이드 추가 배포 준비 완료: Gitea CI/CD 자동 배포 활성화 가능 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
52 lines
1.6 KiB
C#
52 lines
1.6 KiB
C#
using Microsoft.AspNetCore.Authentication.Cookies;
|
|
using MudBlazor.Services;
|
|
using TaxBaik.Application;
|
|
using TaxBaik.Infrastructure;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
|
.AddCookie(opts => {
|
|
opts.LoginPath = "/login";
|
|
opts.ExpireTimeSpan = TimeSpan.FromHours(8);
|
|
opts.Cookie.SameSite = SameSiteMode.Lax;
|
|
});
|
|
builder.Services.AddAuthorizationCore();
|
|
|
|
builder.Services.AddRazorComponents()
|
|
.AddInteractiveServerComponents();
|
|
builder.Services.AddMudServices();
|
|
builder.Services.AddMemoryCache();
|
|
builder.Services.AddInfrastructure();
|
|
builder.Services.AddApplication();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Run migrations on startup
|
|
using (var scope = app.Services.CreateScope())
|
|
{
|
|
var connectionFactory = scope.ServiceProvider.GetRequiredService<TaxBaik.Domain.Interfaces.IDbConnectionFactory>();
|
|
var cs = builder.Configuration.GetConnectionString("Default")
|
|
?? throw new InvalidOperationException("Missing connection string");
|
|
var migrationRunner = new TaxBaik.Infrastructure.Data.MigrationRunner(cs, connectionFactory);
|
|
await migrationRunner.RunAsync();
|
|
}
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UsePathBase("/taxbaik/admin");
|
|
app.UseHttpsRedirection();
|
|
app.UseStaticFiles();
|
|
app.UseRouting();
|
|
app.UseAuthentication();
|
|
app.UseAuthorization();
|
|
|
|
app.MapRazorComponents<TaxBaik.Admin.Components.App>()
|
|
.AddInteractiveServerRenderMode();
|
|
|
|
app.Run();
|