-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
43 lines (35 loc) · 1.66 KB
/
Program.cs
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
39
40
41
42
43
//-----------------------------------------------------------------------
// <copyright file="Program.cs" company="P.O.S Informatique">
// Copyright (c) P.O.S Informatique. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------
namespace PosInformatique.Azure.Communication.UI.Blazor.Demo
{
using Microsoft.AspNetCore.Components.Web;
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
public class Program
{
public static async Task Main(string[] args)
{
var builder = WebAssemblyHostBuilder.CreateDefault(args);
using (var httpClient = new HttpClient())
using (var jsonStream = await httpClient.GetStreamAsync(new Uri(builder.HostEnvironment.BaseAddress + "/appsettings.json")))
{
// usage after the Build(), but it works
builder.Configuration.AddJsonStream(jsonStream);
}
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
// Required by the CallComposite component.
builder.Services.AddCalling();
// Used to create identity user and retrieve ACS tokens.
builder.Services.AddSingleton<IdentityManager>();
builder.Services.Configure<IdentityManagerOptions>(opt =>
{
opt.ConnectionString = builder.Configuration["ACS_CONNECTION_STRING"]!;
});
await builder.Build().RunAsync();
}
}
}