diff options
| author | Roy Ben Shabat <roy.mail.net@gmail.com> | 2025-09-08 16:30:09 +0300 |
|---|---|---|
| committer | Roy Ben Shabat <roy.mail.net@gmail.com> | 2025-09-08 16:30:09 +0300 |
| commit | b9dc6c1c5a3e0db00342291e39c6ae734a64c4c6 (patch) | |
| tree | 2ee683569fa0fa9168888896e34cdf29ad8bfc6b /Software/Visual_Studio_22/Tango.Portal.Chat.Web/Program.cs | |
| parent | d4a3a526d4d4665ed1a1645463d1262138b1f460 (diff) | |
| download | Tango-b9dc6c1c5a3e0db00342291e39c6ae734a64c4c6.tar.gz Tango-b9dc6c1c5a3e0db00342291e39c6ae734a64c4c6.zip | |
Alerts Worker.
Diffstat (limited to 'Software/Visual_Studio_22/Tango.Portal.Chat.Web/Program.cs')
| -rw-r--r-- | Software/Visual_Studio_22/Tango.Portal.Chat.Web/Program.cs | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Program.cs b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Program.cs index 380a9607b..dd063b2f6 100644 --- a/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Program.cs +++ b/Software/Visual_Studio_22/Tango.Portal.Chat.Web/Program.cs @@ -1,4 +1,5 @@ using Azure.Identity; +using Tango.Portal.Chat.Web.Alerts; using Tango.Portal.Chat.Web.Services; var builder = WebApplication.CreateBuilder(args); @@ -19,7 +20,22 @@ builder.Services.AddSingleton<KqlGuard>(); // Azure Storage config builder.Services.Configure<AzureStorageOptions>(builder.Configuration.GetSection("AzureStorage")); builder.Services.AddSingleton<AIInstructionService>(); -builder.Services.AddSession(); +builder.Services.AddSingleton<AlertsQueryService>(); + +// N8N config +builder.Services.Configure<N8NOptions>(builder.Configuration.GetSection("N8N")); +builder.Services.AddHttpClient<N8NService>(); + +// Background service for alerts +builder.Services.AddHostedService<AlertsWorker>(); + +// Session configuration with 1 hour timeout +builder.Services.AddSession(options => +{ + options.IdleTimeout = TimeSpan.FromHours(1); + options.Cookie.HttpOnly = true; + options.Cookie.IsEssential = true; +}); // Simple HTTP client for LLM builder.Services.AddHttpClient<LlmClient>(); @@ -30,6 +46,13 @@ app.UseStaticFiles(); app.UseRouting(); app.UseSession(); +var AazureAlertsHandler = new AzureAlertsHandler(builder.Configuration["ALERTS_SHARED_SECRET"]); + +app.MapPost("/api/monitor-alert", (HttpRequest req) => +{ + return AazureAlertsHandler.HandleAlert(req); +}); + app.MapControllerRoute( name: "default", pattern: "{controller=Home}/{action=Index}/{id?}"); |
