-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProgram.cs
47 lines (37 loc) · 1.47 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
44
45
46
47
using HodladiWallet.Components;
using HodladiWallet.Models;
using HodladiWallet.Services;
namespace HodladiWallet;
public class Program
{
public static void Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
var phoenixApiConfig = new PhoenixApiConfig();
builder.Configuration.GetSection("PhoenixApi").Bind(phoenixApiConfig);
builder.Services.AddSingleton(phoenixApiConfig);
builder.Services.AddScoped<ILightningInvoiceDecoder, LightningInvoiceDecoder>();
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents();
builder.Services.AddHttpClient<IInvoiceService, InvoiceService>((serviceProvider, client) =>
{
var config = serviceProvider.GetRequiredService<PhoenixApiConfig>();
client.BaseAddress = new Uri(config.BaseUrl);
});
// Configure Kestrel to listen on port 5799 for HTTP
builder.WebHost.ConfigureKestrel(serverOptions =>
{
serverOptions.ListenAnyIP(5799); // Listen for HTTP connections on port 5799
});
var app = builder.Build();
if (!app.Environment.IsDevelopment())
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}
app.UseStaticFiles();
app.UseAntiforgery();
app.MapRazorComponents<App>().AddInteractiveServerRenderMode();
app.Run();
}
}