Skip to content

refactor(server): consolidate cloud region config#7728

Merged
addisonbeck merged 3 commits into
mainfrom
pm-38015-cloudregion-config
May 28, 2026
Merged

refactor(server): consolidate cloud region config#7728
addisonbeck merged 3 commits into
mainfrom
pm-38015-cloudregion-config

Conversation

@addisonbeck
Copy link
Copy Markdown
Contributor

@addisonbeck addisonbeck commented May 27, 2026

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-38015
Stacks on #7727

📔 Objective

Introduces CloudRegionConfig as an abstraction around some region-based conditionals across the server. This will be used to simplify adding the new Gov region, which becomes just an addition to CloudRegionConfig after this refactor.

📸 Screenshots

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
Copy link
Copy Markdown

codecov Bot commented May 27, 2026

Codecov Report

❌ Patch coverage is 84.84848% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.58%. Comparing base (30940f1) to head (21f733b).

Files with missing lines Patch % Lines
src/Core/Platform/Mail/HandlebarsMailService.cs 0.00% 7 Missing ⚠️
src/Core/Settings/CloudRegionConfig.cs 92.50% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from pm-38015-cloudregion-to-core to main May 28, 2026 14:42
@addisonbeck addisonbeck marked this pull request as ready for review May 28, 2026 14:45
@addisonbeck addisonbeck requested a review from a team as a code owner May 28, 2026 14:45
@addisonbeck addisonbeck requested a review from dani-garcia May 28, 2026 14:45
@sonarqubecloud
Copy link
Copy Markdown

@addisonbeck addisonbeck merged commit 7d0e729 into main May 28, 2026
43 checks passed
@addisonbeck addisonbeck deleted the pm-38015-cloudregion-config branch May 28, 2026 16:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants