-
Notifications
You must be signed in to change notification settings - Fork 1.3k
CSHARP-3745: Add support for srvServiceName URI option #1284
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.
LGTM
@@ -928,6 +937,11 @@ private void Parse() | |||
throw new MongoConfigurationException("Specifying srvMaxHosts when connecting to a replica set is invalid."); | |||
} | |||
|
|||
if (!_isInternalRepresentation && _srvServiceName != null && _scheme != ConnectionStringScheme.MongoDBPlusSrv) |
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.
Not very clear from the flow, why do we limit this check to _isInternalRepresentation
?
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.
So _isInternalRepresentation
helps to differentiate between a connection string provided by the user and one that has been transformed into a mongodb://
after the SRV and TXT records are resolved from DNS. So we need to check the connection string before the transformation has happened.
src/MongoDB.Driver/MongoDefaults.cs
Outdated
/// <summary> | ||
/// Gets the SRV service name. | ||
/// </summary> | ||
public static string SrvServiceName |
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.
Maybe place it in MongoInternalDefaults
and reuse in ConnectionString
?
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.
Done!
tests/MongoDB.Driver.Core.Tests/Core/Configuration/ClusterSettingsTests.cs
Show resolved
Hide resolved
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.
LGTM
srvServiceName
which allows the user to change the srv address prefix from the default ofmongodb