56 lines
1.9 KiB
C#
56 lines
1.9 KiB
C#
using MudBlazor.Services;
|
|
using Normalize.ClientHub.Models;
|
|
using Serilog;
|
|
using Serilog.Core;
|
|
|
|
namespace Normalize.ClientHub;
|
|
|
|
public class Program
|
|
{
|
|
private static void Main(string[] args)
|
|
{
|
|
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
|
|
LoggingLevelSwitch levelSwitch = new();
|
|
LoggerConfiguration loggerConfiguration = new();
|
|
// _ = loggerConfiguration.WriteTo.BrowserConsole();
|
|
// _ = loggerConfiguration.MinimumLevel.ControlledBy(levelSwitch);
|
|
// _ = loggerConfiguration.Enrich.WithProperty("InstanceId", Guid.NewGuid().ToString("n"));
|
|
// _ = loggerConfiguration.WriteTo.BrowserHttp($"{apiUrl}ingest", controlLevelSwitch: levelSwitch);
|
|
Log.Logger = loggerConfiguration.CreateLogger();
|
|
Serilog.ILogger log = Log.ForContext<Program>();
|
|
|
|
AppSettings appSettings = Models.Binder.AppSettings.Get(builder.Configuration);
|
|
|
|
// Add services to the container.
|
|
_ = builder.Services.AddRazorPages();
|
|
_ = builder.Services.AddMudServices();
|
|
_ = builder.Services.AddServerSideBlazor();
|
|
|
|
_ = builder.Services.AddSingleton(_ => appSettings);
|
|
_ = builder.Services.AddSingleton<IHttpContextAccessor, HttpContextAccessor>();
|
|
|
|
WebApplication app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
_ = 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.UseStaticFiles();
|
|
|
|
_ = app.UseRouting();
|
|
|
|
_ = app.UseAuthorization();
|
|
|
|
_ = app.MapRazorPages();
|
|
|
|
_ = app.MapBlazorHub();
|
|
_ = app.MapFallbackToPage("/_Host");
|
|
|
|
app.Run();
|
|
}
|
|
} |