diff --git a/bitwarden_license/src/Sso/Startup.cs b/bitwarden_license/src/Sso/Startup.cs index 0abfeaf85..95d9d6ce0 100644 --- a/bitwarden_license/src/Sso/Startup.cs +++ b/bitwarden_license/src/Sso/Startup.cs @@ -36,7 +36,8 @@ namespace Bit.Sso var globalSettings = services.AddGlobalSettingsServices(Configuration); // Stripe Billing - StripeConfiguration.ApiKey = globalSettings.StripeApiKey; + StripeConfiguration.ApiKey = globalSettings.Stripe.ApiKey; + StripeConfiguration.MaxNetworkRetries = globalSettings.Stripe.MaxNetworkRetries; // Data Protection services.AddCustomDataProtectionServices(Environment, globalSettings); diff --git a/bitwarden_license/src/Sso/appsettings.json b/bitwarden_license/src/Sso/appsettings.json index 7e1d1be5e..3bf02cd86 100644 --- a/bitwarden_license/src/Sso/appsettings.json +++ b/bitwarden_license/src/Sso/appsettings.json @@ -3,7 +3,9 @@ "selfHosted": false, "siteName": "Bitwarden", "projectName": "SSO", - "stripeApiKey": "SECRET", + "stripe": { + "apiKey": "SECRET" + }, "oidcIdentityClientKey": "SECRET", "sqlServer": { "connectionString": "SECRET" diff --git a/src/Admin/Startup.cs b/src/Admin/Startup.cs index 285a35ad3..90837b913 100644 --- a/src/Admin/Startup.cs +++ b/src/Admin/Startup.cs @@ -44,7 +44,8 @@ namespace Bit.Admin services.AddCustomDataProtectionServices(Environment, globalSettings); // Stripe Billing - StripeConfiguration.ApiKey = globalSettings.StripeApiKey; + StripeConfiguration.ApiKey = globalSettings.Stripe.ApiKey; + StripeConfiguration.MaxNetworkRetries = globalSettings.Stripe.MaxNetworkRetries; // Repositories services.AddSqlServerRepositories(globalSettings); diff --git a/src/Admin/appsettings.json b/src/Admin/appsettings.json index 728a298b5..79bede763 100644 --- a/src/Admin/appsettings.json +++ b/src/Admin/appsettings.json @@ -3,7 +3,9 @@ "selfHosted": false, "siteName": "Bitwarden", "projectName": "Admin", - "stripeApiKey": "SECRET", + "stripe": { + "apiKey": "SECRET" + }, "sqlServer": { "connectionString": "SECRET" }, diff --git a/src/Api/Startup.cs b/src/Api/Startup.cs index 367152444..23eb6a34f 100644 --- a/src/Api/Startup.cs +++ b/src/Api/Startup.cs @@ -61,7 +61,8 @@ namespace Bit.Api } // Stripe Billing - StripeConfiguration.ApiKey = globalSettings.StripeApiKey; + StripeConfiguration.ApiKey = globalSettings.Stripe.ApiKey; + StripeConfiguration.MaxNetworkRetries = globalSettings.Stripe.MaxNetworkRetries; // Repositories services.AddSqlServerRepositories(globalSettings); diff --git a/src/Api/appsettings.json b/src/Api/appsettings.json index 8a2d67665..92922d104 100644 --- a/src/Api/appsettings.json +++ b/src/Api/appsettings.json @@ -3,7 +3,9 @@ "selfHosted": false, "siteName": "Bitwarden", "projectName": "Api", - "stripeApiKey": "SECRET", + "stripe": { + "apiKey": "SECRET" + }, "sqlServer": { "connectionString": "SECRET" }, diff --git a/src/Billing/Startup.cs b/src/Billing/Startup.cs index 237b826a7..ec520f062 100644 --- a/src/Billing/Startup.cs +++ b/src/Billing/Startup.cs @@ -35,7 +35,8 @@ namespace Bit.Billing services.Configure(Configuration.GetSection("BillingSettings")); // Stripe Billing - StripeConfiguration.ApiKey = globalSettings.StripeApiKey; + StripeConfiguration.ApiKey = globalSettings.Stripe.ApiKey; + StripeConfiguration.MaxNetworkRetries = globalSettings.Stripe.MaxNetworkRetries; // Repositories services.AddSqlServerRepositories(globalSettings); diff --git a/src/Billing/appsettings.json b/src/Billing/appsettings.json index c25c3940e..e0e4c162f 100644 --- a/src/Billing/appsettings.json +++ b/src/Billing/appsettings.json @@ -3,7 +3,9 @@ "selfHosted": false, "siteName": "Bitwarden", "projectName": "Billing", - "stripeApiKey": "SECRET", + "stripe": { + "apiKey": "SECRET" + }, "sqlServer": { "connectionString": "SECRET" }, diff --git a/src/Core/Settings/GlobalSettings.cs b/src/Core/Settings/GlobalSettings.cs index 12aa01f87..b41e5e790 100644 --- a/src/Core/Settings/GlobalSettings.cs +++ b/src/Core/Settings/GlobalSettings.cs @@ -18,7 +18,6 @@ namespace Bit.Core.Settings public bool SelfHosted { get; set; } public virtual string KnownProxies { get; set; } public virtual string SiteName { get; set; } - public virtual string StripeApiKey { get; set; } public virtual string ProjectName { get; set; } public virtual string LogDirectory { @@ -68,6 +67,7 @@ namespace Bit.Core.Settings public virtual ServiceBusSettings ServiceBus { get; set; } = new ServiceBusSettings(); public virtual AppleIapSettings AppleIap { get; set; } = new AppleIapSettings(); public virtual SsoSettings Sso { get; set; } = new SsoSettings(); + public virtual StripeSettings Stripe { get; set; } = new StripeSettings(); public string BuildExternalUri(string explicitValue, string name) { @@ -465,5 +465,11 @@ namespace Bit.Core.Settings public string HCaptchaSecretKey { get; set; } public string HCaptchaSiteKey { get; set; } } + + public class StripeSettings + { + public string ApiKey { get; set; } + public int MaxNetworkRetries { get; set; } = 2; + } } } diff --git a/src/Identity/appsettings.json b/src/Identity/appsettings.json index edbc1d118..fb3469b5f 100644 --- a/src/Identity/appsettings.json +++ b/src/Identity/appsettings.json @@ -3,7 +3,9 @@ "selfHosted": false, "siteName": "Bitwarden", "projectName": "Identity", - "stripeApiKey": "SECRET", + "stripe": { + "apiKey": "SECRET" + }, "oidcIdentityClientKey": "SECRET", "sqlServer": { "connectionString": "SECRET"