Skip to content

Commit

Permalink
Remove defaultauthdb portion of mongo connection string (metabase#41553)
Browse files Browse the repository at this point in the history
  • Loading branch information
lbrdnk authored Apr 19, 2024
1 parent c6b7bda commit 271bbdf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

(defn db-details->connection-string
"Generate connection string from database details."
[{:keys [use-conn-uri conn-uri host port dbname additional-options use-srv ssl] :as _db-details}]
[{:keys [use-conn-uri conn-uri host port additional-options use-srv ssl] :as _db-details}]
;; Connection string docs:
;; http://mongodb.github.io/mongo-java-driver/4.11/apidocs/mongodb-driver-core/com/mongodb/ConnectionString.html
(if use-conn-uri
Expand All @@ -33,7 +33,6 @@
host
(when (and (not use-srv) (some? port)) (str ":" port))
"/"
dbname
"?connectTimeoutMS=" (driver.u/db-connection-timeout-ms)
"&serverSelectionTimeoutMS=" (driver.u/db-connection-timeout-ms)
(when ssl "&ssl=true")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
:use-srv true}]
(testing "mongo+srv connection string used when :use-srv is thruthy"
(is (str/includes? (mongo.connection/db-details->connection-string db-details)
"mongodb+srv://test-host.place.com/datadb"))
"mongodb+srv://test-host.place.com/"))
(let [settings (mongo.connection/db-details->mongo-client-settings db-details)
^MongoCredential credential (.getCredential settings)]
(is (= "test-user" (.getUserName credential)))
Expand Down

0 comments on commit 271bbdf

Please sign in to comment.