File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -157,15 +157,19 @@ def init_connection_state(self):
157
157
super ().init_connection_state ()
158
158
159
159
def get_connection_params (self ):
160
- settings_dict = self .settings_dict
161
- return {
162
- "host" : settings_dict ["HOST" ] or None ,
163
- "port" : int (settings_dict ["PORT" ] or 27017 ),
164
- "username" : settings_dict .get ("USER" ),
165
- "password" : settings_dict .get ("PASSWORD" ),
166
- ** settings_dict ["OPTIONS" ],
160
+ settings_dict = {
161
+ "host" : self .settings_dict ["HOST" ] or None ,
162
+ "port" : int (self .settings_dict ["PORT" ] or None ),
163
+ ** self .settings_dict ["OPTIONS" ],
167
164
}
168
165
166
+ if username := settings_dict .get ("USER" ):
167
+ settings_dict ["username" ] = username
168
+ if password := settings_dict .get ("PASSWORD" ):
169
+ settings_dict ["password" ] = password
170
+
171
+ return settings_dict
172
+
169
173
def get_new_connection (self , conn_params ):
170
174
return MongoClient (** conn_params )
171
175
You can’t perform that action at this time.
0 commit comments