Files
webwindowconfigurator/Test.UI/Program.cs
T
Samuele Locatelli 8db91ae95a Update gestione baseUrl
Update grafica x test deploy su develop
2025-12-05 16:06:06 +01:00

63 lines
1.9 KiB
C#

using EgwCoreLib.Lux.Data.Services;
using Microsoft.Extensions.Configuration;
using NLog;
using StackExchange.Redis;
using System.Reflection;
using Test.UI.Client.Pages;
using Test.UI.Components;
var builder = WebApplication.CreateBuilder(args);
var assemblyVersion = Assembly.GetExecutingAssembly().GetName().Version?.ToString();
ConfigurationManager configuration = builder.Configuration;
// Add services to the container.
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();
// costruzione connectionMultiplexer redis...
string connStr = configuration.GetConnectionString("Redis") ?? "localhost";
ConnectionMultiplexer redisConn = ConnectionMultiplexer.Connect(connStr);
// registro connMultiplexer REDIS
builder.Services.AddSingleton<IConnectionMultiplexer>(redisConn);
// registro wrapper servizi REDIS
builder.Services.AddSingleton<IRedisService, RedisService>();
builder.Services.AddSingleton<RedisSubscriptionManager>();
// Aggiunta servizi specifici
builder.Services.AddSingleton<DataLayerServices>();
builder.Services.AddSingleton<ImageCacheService>();
var app = builder.Build();
// aggiunt base URL x routing corretto
string baseUrl = configuration.GetValue<string>("ServerConf:BaseUrl") ?? "";
app.UsePathBase(baseUrl);
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.UseWebAssemblyDebugging();
}
else
{
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();
}
app.UseHttpsRedirection();
app.UseStaticFiles();
app.UseAntiforgery();
app.MapRazorComponents<App>()
.AddInteractiveServerRenderMode()
.AddInteractiveWebAssemblyRenderMode()
.AddAdditionalAssemblies(typeof(Test.UI.Client._Imports).Assembly);
app.Run();