btcpayserver/BTCPayServer/App/BTCPayAppExtensions.cs

26 lines
871 B
C#
Raw Normal View History

2024-05-06 14:33:44 +02:00
using BTCPayServer.App;
using BTCPayServer.Lightning;
using Microsoft.AspNetCore.Builder;
2023-07-03 09:56:00 +02:00
using Microsoft.Extensions.DependencyInjection;
namespace BTCPayServer.Controllers;
public static class BTCPayAppExtensions
{
public static IServiceCollection AddBTCPayApp(this IServiceCollection serviceCollection)
{
serviceCollection.AddSingleton<BTCPayAppState>();
2024-05-06 14:33:44 +02:00
serviceCollection.AddSingleton<ILightningConnectionStringHandler, BTCPayAppLightningConnectionStringHandler>();
serviceCollection.AddHostedService(serviceProvider => serviceProvider.GetRequiredService<BTCPayAppState>());
2023-07-03 09:56:00 +02:00
return serviceCollection;
}
public static void UseBTCPayApp(this IApplicationBuilder builder)
{
builder.UseEndpoints(routeBuilder =>
{
routeBuilder.MapHub<BTCPayAppHub>("hub/btcpayapp");
});
}
}