Skip to content

Commit

Permalink
Prevent Mongo password from being logged in plain text (#167)
Browse files Browse the repository at this point in the history
* Prevent mongo password from appearing in plain-text

* Now should work with mongo's replica set option

* Also remove mongo prefix for anonymous connections

* Log mongo connection using options object
  • Loading branch information
daikema committed Mar 1, 2024
1 parent 2d6c1a1 commit 8e72275
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/database.ts
Expand Up @@ -62,7 +62,8 @@ export async function initDB() {
await updateUsernameIndex(snippetsCollection, false);
await updateUsernameIndex(workspacesCollection, false);
await updateUsernameIndex(preferenceCollection, true);
console.log(`Connected to server ${ServerConfig.database.uri} and database ${ServerConfig.database.databaseName}`);

console.log(`Connected to ${client.options.dbName} on ${client.options.hosts} (Authenticated: ${client.options.credentials ? 'Yes': 'No'})`);
} catch (err) {
verboseError(err);
console.error("Error connecting to database");
Expand Down

0 comments on commit 8e72275

Please sign in to comment.