fixed test connection for electron + better logging

This commit is contained in:
Jan Prochazka
2021-12-30 09:57:24 +01:00
parent 15de3600c3
commit 88469e7366
5 changed files with 37 additions and 28 deletions

View File

@@ -2,6 +2,7 @@ const crypto = require('crypto');
const simpleEncryptor = require('simple-encryptor');
const fs = require('fs');
const path = require('path');
const _ = require('lodash');
const { datadir } = require('./directories');
@@ -81,8 +82,18 @@ function decryptConnection(connection) {
return connection;
}
function pickSafeConnectionInfo(connection) {
return _.mapValues(connection, (v, k) => {
if (k == 'engine' || k == 'port' || k == 'authType' || k == 'sshMode' || k == 'passwordMode') return v;
if (v === null || v === true || v === false) return v;
if (v) return '***';
return undefined;
});
}
module.exports = {
loadEncryptionKey,
encryptConnection,
decryptConnection,
pickSafeConnectionInfo,
};