Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Feb 11, 2022
1 parent fdcf5d5 commit c93902e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/connection_string.ts
Expand Up @@ -28,6 +28,7 @@ import {
AnyOptions,
Callback,
DEFAULT_PK_FACTORY,
emitWarning,
emitWarningOnce,
HostAddress,
isRecord,
Expand Down Expand Up @@ -640,19 +641,21 @@ export const OPTIONS = {
'AWS_SESSION_TOKEN'
];

const properties = Object.create(null);
const mechanismProperties = Object.create(null);

for (const [key, _value] of entriesFromString(value)) {
if (validKeys.includes(key)) {
if (key === 'CANONICALIZE_HOST_NAME') {
properties[key] = getBoolean(key, _value);
mechanismProperties[key] = getBoolean(key, _value);
} else {
properties[key] = _value;
mechanismProperties[key] = _value;
}
}
}

value = properties;
return MongoCredentials.merge(options.credentials, {
mechanismProperties
});
}
if (!isRecord(value)) {
throw new MongoParseError('AuthMechanismProperties must be an object');
Expand Down

0 comments on commit c93902e

Please sign in to comment.