diff options
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/Database.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/util/Database.ts b/src/util/Database.ts index 0732cb4e..ed596907 100644 --- a/src/util/Database.ts +++ b/src/util/Database.ts @@ -3,9 +3,10 @@ import mongoose, { Collection, Connection, LeanDocument } from "mongoose"; import { ChangeStream, ChangeEvent, Long } from "mongodb"; import EventEmitter from "events"; const uri = process.env.MONGO_URL || "mongodb://localhost:27017/fosscord?readPreference=secondaryPreferred"; +import { URL } from "url"; // TODO: auto throw error if findOne doesn't find anything -console.log(`[DB] connect: ${uri}`); +const url = new URL(uri.replace("mongodb://", "http://")); const connection = mongoose.createConnection(uri, { autoIndex: true, @@ -13,6 +14,7 @@ const connection = mongoose.createConnection(uri, { useUnifiedTopology: true, useFindAndModify: false, }); +console.log(`[DB] connect: mongodb://${url.username}@${url.host}${url.pathname}${url.search}`); export default <Connection>connection; |