diff --git a/src/Services/ClientRegistry.php b/src/Services/ClientRegistry.php index 8707fbc..7907acf 100644 --- a/src/Services/ClientRegistry.php +++ b/src/Services/ClientRegistry.php @@ -114,10 +114,8 @@ public function getClient(string $name, ?string $databaseName = null): Client if (! isset($this->clients[$clientKey])) { $conf = $this->configurations[$name]; $options = array_merge( - [ - 'database' => $databaseName, - 'authSource' => $conf->getAuthSource() ?? $databaseName ?? 'admin', - ], + ['database' => $databaseName], + $conf->getAuthSource() !== null ? ['authSource' => $conf->getAuthSource()] : [], $conf->getOptions() ); $this->clients[$clientKey] = $this->buildClient($name, $conf->getUri(), $options, $conf->getDriverOptions());