Allow config to set default block explorer link (#4249)

This logic can potentially be inside BlockExplorerLinkStartupTask instead but it's not a big deal imo
This commit is contained in:
Andrew Camilleri 2022-10-31 03:41:31 +01:00 committed by GitHub
parent ba423a79e3
commit 63620409a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -138,6 +138,7 @@ namespace BTCPayServer.Configuration
{
builder.AppendLine(CultureInfo.InvariantCulture, $"#{n.CryptoCode}.explorer.url={n.NBXplorerNetwork.DefaultSettings.DefaultUrl}");
builder.AppendLine(CultureInfo.InvariantCulture, $"#{n.CryptoCode}.explorer.cookiefile={ n.NBXplorerNetwork.DefaultSettings.DefaultCookieFile}");
builder.AppendLine(CultureInfo.InvariantCulture, $"#{n.CryptoCode}.blockexplorerlink=https://mempool.space/tx/{{0}}");
if (n.SupportLightning)
{
builder.AppendLine(CultureInfo.InvariantCulture, $"#{n.CryptoCode}.lightning=/root/.lightning/lightning-rpc");

View file

@ -189,6 +189,11 @@ namespace BTCPayServer.Hosting
};
options.NBXplorerConnectionSettings.Add(setting);
options.ConnectionString = configuration.GetOrDefault<string>("explorer.postgres", null);
var blockExplorerLink = configuration.GetOrDefault<string>("blockexplorerlink", null);
if (!string.IsNullOrEmpty(blockExplorerLink))
{
btcPayNetwork.BlockExplorerLink = blockExplorerLink;
}
}
});
services.AddOptions<LightningNetworkOptions>().Configure<BTCPayNetworkProvider>(