using TradingBot.Components; using TradingBot.Services; var builder = WebApplication.CreateBuilder(args); // Configure Kestrel per Docker - Listen su tutte le interfacce builder.WebHost.ConfigureKestrel(serverOptions => { // Listen su porta 8080 per Docker serverOptions.ListenAnyIP(8080); }); // Add services to the container. builder.Services.AddRazorComponents() .AddInteractiveServerComponents(); // Trading Bot Services - Using Simulated Market Data builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); // Add health checks for Docker builder.Services.AddHealthChecks(); var app = builder.Build(); // Configure the HTTP request pipeline. if (!app.Environment.IsDevelopment()) { app.UseExceptionHandler("/Error", createScopeForErrors: true); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } // Disabilita HTTPS redirect in Docker/Production // Docker gestisce HTTPS tramite reverse proxy se necessario if (app.Environment.IsDevelopment()) { app.UseHttpsRedirection(); } app.UseStaticFiles(); app.UseAntiforgery(); // Health check endpoint for Docker app.MapHealthChecks("/health"); app.MapRazorComponents() .AddInteractiveServerRenderMode(); app.Run();