mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 03:53:57 +00:00
SYNC: fixed backup & restore under SSH tunnel #1092
This commit is contained in:
committed by
Diflow
parent
e35f9eb75b
commit
cff219674f
@@ -37,6 +37,8 @@ const loadModelTransform = require('../utility/loadModelTransform');
|
|||||||
const exportDbModelSql = require('../utility/exportDbModelSql');
|
const exportDbModelSql = require('../utility/exportDbModelSql');
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
const { callTextToSqlApi, callCompleteOnCursorApi, callRefactorSqlQueryApi } = require('../utility/authProxy');
|
const { callTextToSqlApi, callCompleteOnCursorApi, callRefactorSqlQueryApi } = require('../utility/authProxy');
|
||||||
|
const { decryptConnection } = require('../utility/crypting');
|
||||||
|
const { getSshTunnel } = require('../utility/sshTunnel');
|
||||||
|
|
||||||
const logger = getLogger('databaseConnections');
|
const logger = getLogger('databaseConnections');
|
||||||
|
|
||||||
@@ -619,9 +621,23 @@ module.exports = {
|
|||||||
command,
|
command,
|
||||||
{ conid, database, outputFile, inputFile, options, selectedTables, skippedTables, argsFormat }
|
{ conid, database, outputFile, inputFile, options, selectedTables, skippedTables, argsFormat }
|
||||||
) {
|
) {
|
||||||
const connection = await connections.getCore({ conid });
|
const sourceConnection = await connections.getCore({ conid });
|
||||||
|
let connection = decryptConnection(sourceConnection);
|
||||||
const driver = requireEngineDriver(connection);
|
const driver = requireEngineDriver(connection);
|
||||||
|
|
||||||
|
if (connection.useSshTunnel) {
|
||||||
|
const tunnel = await getSshTunnel(connection);
|
||||||
|
if (tunnel.state == 'error') {
|
||||||
|
throw new Error(tunnel.message);
|
||||||
|
}
|
||||||
|
|
||||||
|
connection = {
|
||||||
|
...connection,
|
||||||
|
server: tunnel.localHost,
|
||||||
|
port: tunnel.localPort,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const settingsValue = await config.getSettings();
|
const settingsValue = await config.getSettings();
|
||||||
|
|
||||||
const externalTools = {};
|
const externalTools = {};
|
||||||
|
|||||||
Reference in New Issue
Block a user