-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathProgram.cs
More file actions
38 lines (31 loc) · 1.82 KB
/
Program.cs
File metadata and controls
38 lines (31 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
using PrompterOne.Shared.Localization;
using PrompterOne.Shared.Services;
using PrompterOne.Shared.Settings.Services;
using PrompterOne.Web;
using PrompterOne.Web.Services;
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Logging.AddConfiguration(builder.Configuration.GetSection("Logging"));
builder.Logging.SetMinimumLevel(LogLevel.Information);
builder.Logging.AddFilter("PrompterOne", LogLevel.Information);
builder.Logging.AddFilter("Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer", LogLevel.Warning);
var runtimeTelemetryHostEnabled =
builder.Configuration.GetValue<bool?>(RuntimeTelemetryOptions.HostEnabledPath)
?? !builder.HostEnvironment.IsDevelopment();
var runtimeTelemetryOptions = new RuntimeTelemetryOptions(
builder.Configuration[RuntimeTelemetryOptions.GoogleAnalyticsMeasurementIdPath] ?? string.Empty,
builder.Configuration[RuntimeTelemetryOptions.ClarityProjectIdPath] ?? string.Empty,
builder.Configuration[RuntimeTelemetryOptions.SentryDsnPath] ?? string.Empty,
HostEnabled: runtimeTelemetryHostEnabled);
builder.Services.AddLocalization();
builder.Services.AddSingleton<IFormFactor, FormFactor>();
builder.Services.AddSingleton<IAppVersionProvider>(_ => AppVersionProviderFactory.CreateFromAssembly(typeof(Program).Assembly));
builder.Services.AddPrompterOneShared(runtimeTelemetryOptions);
RuntimeSentryBootstrapper.Configure(builder, runtimeTelemetryOptions);
var host = builder.Build();
RuntimeSentryBootstrapper.DisableForWasmDebug(host.Services);
await host.Services.GetRequiredService<AppCulturePreferenceService>().InitializeAsync();
await host.RunAsync();