Override authentication_source
by "authSource" in URI
This commit is contained in:
parent
7e1a5ce445
commit
24a9633edc
@ -1,4 +1,3 @@
|
|||||||
import pymongo
|
|
||||||
from pymongo import MongoClient, MongoReplicaSetClient, uri_parser
|
from pymongo import MongoClient, MongoReplicaSetClient, uri_parser
|
||||||
|
|
||||||
|
|
||||||
@ -58,8 +57,11 @@ def register_connection(alias, name=None, host=None, port=None,
|
|||||||
'password': uri_dict.get('password'),
|
'password': uri_dict.get('password'),
|
||||||
'read_preference': read_preference,
|
'read_preference': read_preference,
|
||||||
})
|
})
|
||||||
if "replicaSet" in conn_settings['host']:
|
uri_options = uri_dict['options']
|
||||||
|
if 'replicaset' in uri_options:
|
||||||
conn_settings['replicaSet'] = True
|
conn_settings['replicaSet'] = True
|
||||||
|
if 'authsource' in uri_options:
|
||||||
|
conn_settings['authentication_source'] = uri_options['authsource']
|
||||||
|
|
||||||
# Deprecated parameters that should not be passed on
|
# Deprecated parameters that should not be passed on
|
||||||
kwargs.pop('slaves', None)
|
kwargs.pop('slaves', None)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user