mirror of
https://github.com/bitwarden/server.git
synced 2025-04-15 18:18:12 -05:00
fix bitpay initalization
This commit is contained in:
parent
e2be61da0a
commit
685928a4c7
@ -13,7 +13,8 @@ namespace Bit.Api.Controllers
|
|||||||
private readonly BitPayClient _bitPayClient;
|
private readonly BitPayClient _bitPayClient;
|
||||||
private readonly GlobalSettings _globalSettings;
|
private readonly GlobalSettings _globalSettings;
|
||||||
|
|
||||||
public MiscController(BitPayClient bitPayClient,
|
public MiscController(
|
||||||
|
BitPayClient bitPayClient,
|
||||||
GlobalSettings globalSettings)
|
GlobalSettings globalSettings)
|
||||||
{
|
{
|
||||||
_bitPayClient = bitPayClient;
|
_bitPayClient = bitPayClient;
|
||||||
|
@ -58,13 +58,14 @@ namespace Bit.Api
|
|||||||
// Caching
|
// Caching
|
||||||
services.AddMemoryCache();
|
services.AddMemoryCache();
|
||||||
|
|
||||||
|
// BitPay
|
||||||
|
services.AddSingleton<BitPayClient>();
|
||||||
|
|
||||||
if(!globalSettings.SelfHosted)
|
if(!globalSettings.SelfHosted)
|
||||||
{
|
{
|
||||||
// Rate limiting
|
// Rate limiting
|
||||||
services.AddSingleton<IIpPolicyStore, MemoryCacheIpPolicyStore>();
|
services.AddSingleton<IIpPolicyStore, MemoryCacheIpPolicyStore>();
|
||||||
services.AddSingleton<IRateLimitCounterStore, MemoryCacheRateLimitCounterStore>();
|
services.AddSingleton<IRateLimitCounterStore, MemoryCacheRateLimitCounterStore>();
|
||||||
// BitPay
|
|
||||||
services.AddSingleton<BitPayClient>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Identity
|
// Identity
|
||||||
|
@ -8,12 +8,15 @@ namespace Bit.Core.Utilities
|
|||||||
private readonly NBitpayClient.Bitpay _bpClient;
|
private readonly NBitpayClient.Bitpay _bpClient;
|
||||||
|
|
||||||
public BitPayClient(GlobalSettings globalSettings)
|
public BitPayClient(GlobalSettings globalSettings)
|
||||||
|
{
|
||||||
|
if(CoreHelpers.SettingHasValue(globalSettings.BitPay.Base58Secret))
|
||||||
{
|
{
|
||||||
var btcSecret = new NBitcoin.BitcoinSecret(globalSettings.BitPay.Base58Secret,
|
var btcSecret = new NBitcoin.BitcoinSecret(globalSettings.BitPay.Base58Secret,
|
||||||
globalSettings.BitPay.Production ? null : NBitcoin.Network.TestNet);
|
globalSettings.BitPay.Production ? null : NBitcoin.Network.TestNet);
|
||||||
_bpClient = new NBitpayClient.Bitpay(btcSecret.PrivateKey,
|
_bpClient = new NBitpayClient.Bitpay(btcSecret.PrivateKey,
|
||||||
new Uri(globalSettings.BitPay.Production ? "https://bitpay.com/" : "https://test.bitpay.com/"));
|
new Uri(globalSettings.BitPay.Production ? "https://bitpay.com/" : "https://test.bitpay.com/"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Task<bool> TestAccessAsync()
|
public Task<bool> TestAccessAsync()
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user