-
Notifications
You must be signed in to change notification settings - Fork 1
Set the region to be the closest to the user #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughAdds geolocation-based default region selection to database creation. Fetches user location from ipapi.co, computes nearest predefined region via Haversine distance, and uses it as the default. Falls back to "us-east-1" if location is unavailable. Existing region listing, validation, and creation flows remain unchanged. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant U as User
participant CLI as create-db/index.js
participant Geo as ipapi.co
participant Sel as Region Selector
participant Svc as DB Service
U->>CLI: Run create-db
rect rgb(235, 245, 255)
note right of CLI: New: location-based default region
CLI->>Geo: detectUserLocation() (HTTP, User-Agent)
alt Location available
Geo-->>CLI: country/region/city/lat/lon
CLI->>Sel: getRegionClosestToLocation(location)
Sel-->>CLI: nearestRegionId
CLI->>CLI: region = nearestRegionId
else Location unavailable/error
Geo--x CLI: failure/null
CLI->>CLI: region = "us-east-1" (fallback)
end
end
CLI->>CLI: validate region
alt Valid
CLI->>Svc: create database (region)
Svc-->>CLI: creation result
CLI-->>U: Output success/details
else Invalid
CLI-->>U: Error: invalid region
end
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Deploying with
|
Status | Name | Latest Commit | Preview URL | Updated (UTC) |
---|---|---|---|---|
✅ Deployment successful! View logs |
claim-db-worker | b58830f | Commit Preview URL Branch Preview URL |
Aug 26 2025, 09:01 PM |
✅ Preview CLIs & Workers are live! Test the CLIs locally under tag npx create-db@pr47
npx create-pg@pr47
npx create-postgres@$pr47 Worker URLs
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 5
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
create-db/index.js
(2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
create-db/index.js (1)
create-db-worker/src/index.ts (1)
fetch
(13-115)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Workers Builds: claim-db-worker
- GitHub Check: Workers Builds: create-db-worker
Checks the geolocation of the user and finds the closest region
Summary by CodeRabbit