Skip to content

TW-5009: centralize API base URL resolution to respect api.base_url config#81

Merged
qasim-nylas merged 1 commit into
mainfrom
TW-5009/respect-api-base-url-config
May 14, 2026
Merged

TW-5009: centralize API base URL resolution to respect api.base_url config#81
qasim-nylas merged 1 commit into
mainfrom
TW-5009/respect-api-base-url-config

Conversation

@qasim-nylas
Copy link
Copy Markdown
Collaborator

Summary

  • Adds Config.ResolveBaseURL() in the domain layer to centralize base URL resolution logic (api.base_url > region > US default)
  • Adds HTTPClient.ApplyConfig() as a single entry point replacing scattered SetRegion()/SetBaseURL() if/else blocks across 10+ call sites
  • Fixes nylas doctor network check to respect configured base URL instead of hardcoding api.us.nylas.com

Test plan

  • Unit tests for ResolveBaseURL() — US default, EU region, custom base URL precedence, empty/nil edge cases
  • Unit tests for ApplyConfig() — nil config no-op, region selection, custom URL override
  • nylas doctor reports correct connectivity against configured base URL
  • nylas auth login and nylas init work with api.base_url set in config
  • EU region users unaffected when no api.base_url is configured

Related docs

…onfig

Adds Config.ResolveBaseURL() and HTTPClient.ApplyConfig() to replace
scattered SetRegion/SetBaseURL patterns, ensuring all API calls honor
the api.base_url config when set.
@qasim-nylas qasim-nylas requested a review from AaronDDM May 14, 2026 11:53
Copy link
Copy Markdown
Collaborator

@AaronDDM AaronDDM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@qasim-nylas qasim-nylas merged commit 4ec04d7 into main May 14, 2026
6 checks passed
@qasim-nylas qasim-nylas deleted the TW-5009/respect-api-base-url-config branch May 14, 2026 12:18
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