mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-26 06:26:00 +00:00
encrypting password, key is stored on backend in .key file
This commit is contained in:
@@ -5,6 +5,7 @@ const nedb = require('nedb-promises');
|
||||
|
||||
const { datadir } = require('../utility/directories');
|
||||
const socket = require('../utility/socket');
|
||||
const { encryptConnection } = require('../utility/crypting');
|
||||
|
||||
function getPortalCollections() {
|
||||
if (process.env.CONNECTIONS) {
|
||||
@@ -59,10 +60,11 @@ module.exports = {
|
||||
async save(connection) {
|
||||
if (portalConnections) return;
|
||||
let res;
|
||||
const encrypted = encryptConnection(connection);
|
||||
if (connection._id) {
|
||||
res = await this.datastore.update(_.pick(connection, '_id'), connection);
|
||||
res = await this.datastore.update(_.pick(connection, '_id'), encrypted);
|
||||
} else {
|
||||
res = await this.datastore.insert(connection);
|
||||
res = await this.datastore.insert(encrypted);
|
||||
}
|
||||
socket.emitChanged('connection-list-changed');
|
||||
return res;
|
||||
|
||||
@@ -28,7 +28,7 @@ const hasPermission = require('../utility/hasPermission');
|
||||
// }
|
||||
|
||||
const preinstallPluginMinimalVersions = {
|
||||
'dbgate-plugin-mssql': '1.0.8',
|
||||
'dbgate-plugin-mssql': '1.0.9',
|
||||
'dbgate-plugin-mysql': '1.0.2',
|
||||
'dbgate-plugin-postgres': '1.0.2',
|
||||
'dbgate-plugin-csv': '1.0.8',
|
||||
|
||||
Reference in New Issue
Block a user