Changes
Build and Push Docker Images / build (push) Successful in 2s

This commit is contained in:
2026-05-04 21:41:14 +03:00
parent 30370e0e90
commit 20b4127fda
17 changed files with 502 additions and 463 deletions
+14 -1
View File
@@ -1,10 +1,12 @@
using Azure.Identity;
using Microsoft.AspNetCore.Diagnostics;
using Api.Data;
using Api.Services;
using Api.Services.Contracts;
using Api.Settings;
using Serilog;
using System.Reflection;
using Microsoft.EntityFrameworkCore;
DotNetEnv.Env.Load();
@@ -64,8 +66,12 @@ try
builder.Services.Configure<AiSettings>(builder.Configuration.GetSection("Ai"));
builder.Services.Configure<InternalApiSettings>(builder.Configuration.GetSection("InternalApi"));
builder.Services.AddDbContext<RagDbContext>(options =>
options.UseSqlServer(builder.Configuration.GetConnectionString("RagDb")
?? throw new InvalidOperationException("Connection string 'RagDb' is missing.")));
builder.Services.AddHttpClient<RawAiClient>();
builder.Services.AddSingleton<IRagRepository, SqlRagRepository>();
builder.Services.AddScoped<IRagRepository, EfRagRepository>();
builder.Services.AddScoped<IAiClient, CachedAiClient>();
builder.Services.AddSingleton<ITextExtractor, TextExtractor>();
builder.Services.AddSingleton<ITextChunker, TextChunker>();
@@ -159,6 +165,13 @@ try
app.MapControllers();
app.MapGet("/health", () => Results.Ok(new { status = "ok", service = "rag-api", version = appVersion, timeUtc = DateTimeOffset.UtcNow }));
Log.Information("Running EfCore DbMigrations if any");
using (var scope = app.Services.CreateScope())
{
var db = scope.ServiceProvider.GetRequiredService<RagDbContext>();
db.Database.Migrate();
}
Log.Information("{Service} startup complete", "rag-api");
app.Run();
}