370: Support for connection parameters passed via the DB connection s… #402
+466
−25
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.
Support Connection URL Parameters for All Database Types
Summary
This PR adds support for parsing connection parameters from URI query strings for PostgreSQL, MongoDB, and MySQL database connections. Users can now specify connection timeout, pool settings, and other connection-specific parameters directly in the connection URI, making configuration more flexible and consistent with standard database connection string practices.
Changes
Supported URL Formats
PostgreSQL
URL Format:
postgresql://[username]:[password]@[hostname]:[port]/[database]?[query_params]Example:
MongoDB
URL Format:
mongodb://[username]:[password]@[hostname]:[port]/[database]?[query_params]Example:
MySQL
URL Format:
mysql://[username]:[password]@[hostname]:[port]/[database]?[query_params]Example:
Supported Parameters
PostgreSQL
connect_timeoutkeepaliveskeepalives_idlekeepalives_intervalkeepalives_countNote:
keepalives_intervalandkeepalives_countare accepted but cannot be directly applied at the Node.js socket level (limitation of the socket API).MongoDB
connectTimeoutMSsocketTimeoutMSserverSelectionTimeoutMSmaxPoolSizemaxIdleTimeMSMySQL
connectTimeoutconnectionLimitqueueLimittimeoutNote: The
timeoutparameter is accepted in the config but is not a validPoolOptionsproperty in mysql2. Query timeouts are handled at the query level, not pool level.Parameter Naming Conventions
Each database type uses a naming convention that matches its underlying driver/library:
snake_case(matches libpq conventions)camelCase(matches MongoDB Node.js driver conventions)camelCase(matches mysql2 driver conventions)Important: You must use the correct naming convention for each database type. Mixing conventions will not work (e.g., using
connectTimeoutin a PostgreSQL URI will be ignored).Usage Examples
PostgreSQL
MongoDB
MySQL
Validation
Testing
Comprehensive test coverage has been added for: