Skip to content

Commit

Permalink
Merge pull request #15 from zishone/dev
Browse files Browse the repository at this point in the history
mongover@1.2.1: Remove logging of db credentials
  • Loading branch information
zishone committed Apr 10, 2020
2 parents 11408d6 + df86830 commit 58c3a6f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mongover",
"version": "1.2.0",
"version": "1.2.1",
"description": "A MongoDB Server Database Migration Tool",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
10 changes: 6 additions & 4 deletions src/core/connect-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import { getLogger } from '../utils/get-logger';
const logger = getLogger(__filename);

export async function connectServer(uri: string, options: MongoClientOptions): Promise<MongoClient> {
const loggableUri = uri.substring(0, uri.indexOf('://') + 3) +
(uri.includes('@') ? uri.substring(uri.indexOf('@') + 1, uri.indexOf('?')) : uri.substring(uri.indexOf('://') + 3, uri.length));
try {
logger.debug('Connecting to the Server: %s', uri);
logger.cli('- Connecting to the Server: %s', uri);
logger.debug('Connecting to the Server: %s', loggableUri);
logger.cli('- Connecting to the Server: %s', loggableUri);
return await MongoClient.connect(uri, options);
} catch (error) {
logger.error('Error connecting to the Server: %s', uri);
logger.cli('- Error connecting to the Server: %s', uri);
logger.error('Error connecting to the Server: %s', loggableUri);
logger.cli('- Error connecting to the Server: %s', loggableUri);
throw error;
}
}

0 comments on commit 58c3a6f

Please sign in to comment.