Implemented update functionallity
All checks were successful
Updater CI/CD / publish (push) Successful in 2m18s

This commit is contained in:
2026-02-24 18:49:23 +01:00
commit a341b9cfda
16 changed files with 255 additions and 0 deletions

26
Program.cs Normal file
View File

@@ -0,0 +1,26 @@
using ServiceUpdater;
var builder = WebApplication.CreateSlimBuilder(args);
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
builder.Services.AddSingleton<UpdaterConfig>();
builder.Services.AddScoped<UpdateWorker>();
var app = builder.Build();
if (app.Environment.IsDevelopment()) {
app.MapOpenApi();
}
app.MapGet("update/{service}", async (UpdateWorker worker, string service, HttpContext context) => {
context.Response.Headers.Append("Content-Type", "text/event-stream");
await foreach (var line in worker.UpdateService(service)) {
await context.Response.WriteAsync(line + '\n');
await context.Response.Body.FlushAsync();
}
});
app.Run();