45 lines
1.5 KiB
C#
45 lines
1.5 KiB
C#
using DiunaBI.UI.Shared;
|
|
using DiunaBI.UI.Shared.Extensions;
|
|
using DiunaBI.UI.Shared.Services;
|
|
using DiunaBI.UI.Web.Components;
|
|
using MudBlazor.Services;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
builder.Services.AddRazorComponents()
|
|
.AddInteractiveServerComponents();
|
|
builder.Services.AddMudServices();
|
|
|
|
var apiBaseUrl = builder.Configuration["ApiSettings:BaseUrl"]
|
|
?? throw new InvalidOperationException("ApiSettings:BaseUrl is not configured");
|
|
builder.Services.AddSharedServices(apiBaseUrl);
|
|
|
|
// Configure App settings
|
|
var appConfig = builder.Configuration.GetSection("App").Get<AppConfig>() ?? new AppConfig();
|
|
Console.WriteLine($"[DEBUG] AppConfig.AppName from config: {appConfig.AppName}");
|
|
Console.WriteLine($"[DEBUG] App:AppName from Configuration: {builder.Configuration["App:AppName"]}");
|
|
Console.WriteLine($"[DEBUG] App__AppName env var: {Environment.GetEnvironmentVariable("App__AppName")}");
|
|
builder.Services.AddSingleton(appConfig);
|
|
|
|
builder.Services.AddScoped<IGoogleAuthService, WebGoogleAuthService>();
|
|
|
|
var app = builder.Build();
|
|
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
|
app.UseHsts();
|
|
}
|
|
|
|
app.UseHttpsRedirection();
|
|
app.UseAntiforgery();
|
|
|
|
app.MapStaticAssets();
|
|
|
|
app.MapGet("/health", () => Results.Ok(new { status = "OK", timestamp = DateTime.UtcNow }));
|
|
|
|
app.MapRazorComponents<App>()
|
|
.AddInteractiveServerRenderMode()
|
|
.AddAdditionalAssemblies(typeof(MainLayout).Assembly);
|
|
|
|
app.Run(); |