-
Notifications
You must be signed in to change notification settings - Fork 110
fix(connection): support for multiple hosts urls #327 #514
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
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.
Pull Request Overview
This PR fixes a bug where MongoDB connection strings with multiple hosts were incorrectly parsed as arrays instead of being treated as valid URL strings. The fix adds special handling for MongoDB URLs in the environment variable parsing logic.
- Added MongoDB protocol detection to skip preprocessing of connection strings
- Added test coverage for multiple-host MongoDB URLs
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
src/common/config.ts | Added MongoDB URL detection to prevent preprocessing of connection strings starting with mongodb:// or mongodb+srv:// |
tests/unit/common/config.test.ts | Added test case to verify multiple-host MongoDB URLs are preserved correctly |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Environment variables are always strings, but we will add this check in case we receive something that is not process.env.
CLI parsing doesn't have that issue but, in case we refactor add a test to ensure we don't regress here.
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.
Looks perfect 💯
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.
non-blocking comment
Pull Request Test Coverage Report for Build 17461171989Details
💛 - Coveralls |
Proposed changes
Bug: MongoDB URLs passed as environment variables that contain multiple hosts are treated as arrays instead of actual URLS.
Fix: When the environment variable contents start with a mongodb connection protocol (mongodb://, mongodb+srv://) it skips preprocessing the contents and stores it in the config as is.
Fixes:
Checklist