* Initial plan * Implement caching for transport connection results with IMemoryCache Co-authored-by: clayschaad <11883505+clayschaad@users.noreply.github.com> * Change cache duration from minutes to days Co-authored-by: clayschaad <11883505+clayschaad@users.noreply.github.com> * Implement CachedTransportService design with interface separation Co-authored-by: clayschaad <11883505+clayschaad@users.noreply.github.com> * Implement persistent file-based cache to survive application restarts Co-authored-by: clayschaad <11883505+clayschaad@users.noreply.github.com> * Revert persistent file-based cache implementation, restore IMemoryCache usage Co-authored-by: clayschaad <11883505+clayschaad@users.noreply.github.com> * Code cleanup --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: clayschaad <11883505+clayschaad@users.noreply.github.com> Co-authored-by: Claudio Schaad <c.schaad@pog.ch>
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using ShiftScheduler.Services;
|
|
using ShiftScheduler.Shared;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Load configurations from appsettings.json
|
|
var shifts = builder.Configuration.GetSection("Shifts").Get<List<Shift>>() ?? new();
|
|
var transportConfig = builder.Configuration.GetSection("Transport").Get<TransportConfiguration>() ?? new();
|
|
|
|
// Register services
|
|
builder.Services.AddSingleton(shifts);
|
|
builder.Services.AddSingleton(transportConfig);
|
|
builder.Services.AddMemoryCache();
|
|
builder.Services.AddHttpClient<TransportApiService>();
|
|
builder.Services.AddSingleton<ShiftService>();
|
|
builder.Services.AddSingleton<IcsExportService>();
|
|
builder.Services.AddSingleton<PdfExportService>();
|
|
builder.Services.AddSingleton<ITransportApiService, TransportApiService>();
|
|
builder.Services.AddSingleton<ITransportService, TransportService>();
|
|
|
|
builder.Services.AddControllersWithViews();
|
|
builder.Services.AddRazorPages();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseWebAssemblyDebugging();
|
|
}
|
|
else
|
|
{
|
|
app.UseExceptionHandler("/Error");
|
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
|
|
app.UseBlazorFrameworkFiles();
|
|
app.UseStaticFiles();
|
|
|
|
app.UseRouting();
|
|
|
|
|
|
app.MapRazorPages();
|
|
app.MapControllers();
|
|
app.MapFallbackToFile("index.html");
|
|
|
|
app.Run();
|