Add GlobalSettingsBridge library - #8156
Conversation
Bridges GlobalSettings-style configuration into IConfigureOptions<T> for CorsOptions, ForwardedHeadersOptions, and SelfHostDetails, so services can migrate away from direct GlobalSettings dependencies.
5d6d7fb to
9b307cb
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8156 +/- ##
===========================================
+ Coverage 15.10% 63.06% +47.96%
===========================================
Files 1417 2319 +902
Lines 61422 100593 +39171
Branches 4901 9057 +4156
===========================================
+ Hits 9279 63441 +54162
+ Misses 51978 34963 -17015
- Partials 165 2189 +2024 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the new Code Review Details
Dependency Changes
|
🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-34549
📔 Objective
Introduces a new
GlobalSettingsBridgelibrary (src/Libraries/GlobalSettingsBridge/) that bridgesglobalSettings-styleIConfigurationkeys into the ASP.NET Core options pattern viaIConfigureOptions<T>.Calling
services.AddGlobalSettingsBridge()registers three configurators:ConfigureSelfHostDetails— readsglobalSettings:selfHosted/globalSettings:liteDeploymentand populatesSelfHostDetails(the SDK's environment type).ConfigureCorsOptions— readsglobalSettings:baseServiceUri:vaultand usesIBitwardenEnvironment.SelfHostedto configure the default CORS policy, replacing directGlobalSettingsusage in middleware setup.ConfigureForwardedHeadersOptions— readsglobalSettings:knownProxies/globalSettings:knownNetworks, handles the nginx DNS lookup for non-lite self-hosted deployments, and setsForwardLimit = nullwhen multiple proxies/networks are configured.The library has no dependency on
Bit.CoreorGlobalSettingsdirectly — it reads all config viaIConfiguration. It usesBitwarden.Server.Sdk(withBitIncludeFeatures=false) to pick up theBitwarden.Server.Sdk.Environmentpackage.This method is intended for services migrating away from direct GlobalSettings dependencies. New services should configure
CorsOptions,ForwardedHeadersOptions, andSelfHostDetailsdirectly.📸 Screenshots
N/A — no UI changes.