refactor(server): consolidate cloud region config#7728
Merged
Conversation
Decouples CloudRegion from Bit.Setup.Enums so any project consuming Core can reference it without a circular dependency back into the Setup utility. Updates the three downstream Setup references (Context.cs, Program.cs, Setup.csproj) to point at the new Bit.Core.Enums namespace. Lands as a standalone PR ahead of PM-35087 (FedRAMP / bitwarden-gov.com) so SHOT can review the Setup->Core boundary move in isolation. Refs: PM-38015
Introduces Bit.Core.Settings.CloudRegionConfig -- a sealed class with a static All array (US + EU entries) and FindByDomain/FindByRegion helpers -- so per-region URLs live in one place. Refactors three consumers that previously duplicated hardcoded US/EU strings: Constants.cs derives BitwardenCloudDomains and BitwardenMobileSsoCallbackUris from CloudRegionConfig.All; ServiceCollectionExtensions.cs replaces two hardcoded AddSwaggerServerWithSecurity calls with a foreach; HandlebarsMailService.GetCloudVaultSubscriptionUrl is widened to public and switches from a string switch to FindByRegion(). Adding a new region is now a single entry in CloudRegionConfig.All. We'll be using this right away to add the Gov region. Refs: PM-38015
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7728 +/- ##
==========================================
+ Coverage 60.56% 60.58% +0.01%
==========================================
Files 2145 2146 +1
Lines 95028 95074 +46
Branches 8504 8507 +3
==========================================
+ Hits 57558 57599 +41
- Misses 35445 35450 +5
Partials 2025 2025 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
dani-garcia
approved these changes
May 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-38015
Stacks on #7727
📔 Objective
Introduces
CloudRegionConfigas an abstraction around some region-based conditionals across the server. This will be used to simplify adding the newGovregion, which becomes just an addition toCloudRegionConfigafter this refactor.📸 Screenshots