e7e01d0cd8
TaxBaik CI/CD / build-and-deploy (push) Failing after 15s
- MigrationRunner: 이미 존재하는 테이블에 대한 "relation already exists" 오류 처리 - V002, V003 마이그레이션: ON CONFLICT DO NOTHING으로 멱등성 보장 - Web, Admin Program.cs: app.UseAntiforgery() 미들웨어 추가 (anti-forgery 토큰 검증) 변경사항: - 마이그레이션 재실행 시에도 안전하게 처리 - 폼 제출 시 CSRF 공격 방지 - 관리자 로그인 페이지 405 에러 해결 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
43 lines
1.2 KiB
C#
43 lines
1.2 KiB
C#
using System.IO.Compression;
|
|
using Microsoft.AspNetCore.ResponseCompression;
|
|
using TaxBaik.Application;
|
|
using TaxBaik.Infrastructure;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.AddRazorPages();
|
|
builder.Services.AddMemoryCache();
|
|
builder.Services.AddResponseCompression(opts => {
|
|
opts.Providers.Add<GzipCompressionProvider>();
|
|
});
|
|
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();
|
|
}
|
|
|
|
app.UsePathBase("/taxbaik");
|
|
app.UseResponseCompression();
|
|
app.UseStaticFiles();
|
|
app.UseRouting();
|
|
app.UseAntiforgery();
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error");
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.MapRazorPages();
|
|
|
|
app.Run();
|