mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using BTCPayServer.Abstractions.Contracts;
|
|
using BTCPayServer.Services;
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
namespace BTCPayServer.Hosting
|
|
{
|
|
public class BlockExplorerLinkStartupTask : IStartupTask
|
|
{
|
|
private readonly BTCPayNetworkProvider _btcPayNetworkProvider;
|
|
private readonly TransactionLinkProviders _transactionLinksProviders;
|
|
private readonly IConfiguration _configuration;
|
|
|
|
public BlockExplorerLinkStartupTask(
|
|
BTCPayNetworkProvider btcPayNetworkProvider,
|
|
TransactionLinkProviders transactionLinksProviders,
|
|
IConfiguration configuration)
|
|
{
|
|
_btcPayNetworkProvider = btcPayNetworkProvider;
|
|
_transactionLinksProviders = transactionLinksProviders;
|
|
_configuration = configuration;
|
|
}
|
|
|
|
public async Task ExecuteAsync(CancellationToken cancellationToken = default)
|
|
{
|
|
var blockExplorerLink = _configuration["blockexplorerlink"];
|
|
if (!string.IsNullOrEmpty(blockExplorerLink))
|
|
{
|
|
foreach (var prov in _transactionLinksProviders.Values)
|
|
prov.OverrideBlockExplorerLink = blockExplorerLink;
|
|
}
|
|
await _transactionLinksProviders.RefreshTransactionLinkTemplates();
|
|
}
|
|
}
|
|
}
|