adb6e9e875
TaxBaik CI/CD / build-and-deploy (push) Successful in 1m2s
- 포트 5001로 설정 (기존 5012 → 5001) - DB 연결 없이도 페이지 렌더링 가능하도록 error handling 추가 - Index.cshtml.cs: 블로그 로드 실패 시 빈 리스트 반환 - Blog/Index.cshtml.cs: 카테고리 및 포스트 로드 실패 시 빈 리스트 반환 - Contact.cshtml.cs: 문의 제출 실패 시 사용자 친화적 에러 메시지 - Program.cs: 마이그레이션을 non-blocking으로 변경 페이지 구성: - 홈페이지 (Index): 회사 소개 및 최근 블로그 - 블로그 (Blog): 게시글 목록 및 카테고리 필터 - 서비스 (Services): 서비스 소개 - 문의 (Contact): 상담 신청 폼 - 소개 (About): 회사 정보 Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
72 lines
2.1 KiB
C#
72 lines
2.1 KiB
C#
using System.IO.Compression;
|
|
using System.Text.Encodings.Web;
|
|
using System.Text.Unicode;
|
|
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.AddSingleton(HtmlEncoder.Create(UnicodeRanges.All));
|
|
|
|
builder.Services.AddInfrastructure();
|
|
builder.Services.AddApplication();
|
|
|
|
// Register version info
|
|
var versionInfo = new VersionInfo();
|
|
var versionFilePath = Path.Combine(AppContext.BaseDirectory, "wwwroot", "version.txt");
|
|
if (File.Exists(versionFilePath))
|
|
{
|
|
var lines = File.ReadAllLines(versionFilePath);
|
|
foreach (var line in lines)
|
|
{
|
|
if (line.StartsWith("Version:"))
|
|
versionInfo.Version = line.Substring("Version:".Length).Trim();
|
|
else if (line.StartsWith("Built:"))
|
|
versionInfo.Built = line.Substring("Built:".Length).Trim();
|
|
}
|
|
}
|
|
builder.Services.AddSingleton(versionInfo);
|
|
|
|
var app = builder.Build();
|
|
|
|
// Run migrations on startup (non-blocking for development)
|
|
try
|
|
{
|
|
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();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine($"⚠️ Migration warning (non-blocking): {ex.Message}");
|
|
}
|
|
|
|
app.UsePathBase("/taxbaik");
|
|
app.UseResponseCompression();
|
|
app.UseStaticFiles();
|
|
app.UseRouting();
|
|
app.UseAntiforgery();
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error");
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.MapRazorPages();
|
|
|
|
app.Run();
|