mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-05-01 16:43:59 +00:00
SYNC: fixed allocating port for native backup & restore #1092
This commit is contained in:
committed by
Diflow
parent
725399ac7c
commit
4b3c0466eb
@@ -622,20 +622,23 @@ module.exports = {
|
|||||||
{ conid, database, outputFile, inputFile, options, selectedTables, skippedTables, argsFormat }
|
{ conid, database, outputFile, inputFile, options, selectedTables, skippedTables, argsFormat }
|
||||||
) {
|
) {
|
||||||
const sourceConnection = await connections.getCore({ conid });
|
const sourceConnection = await connections.getCore({ conid });
|
||||||
let connection = decryptConnection(sourceConnection);
|
const connection = {
|
||||||
|
...decryptConnection(sourceConnection),
|
||||||
|
};
|
||||||
const driver = requireEngineDriver(connection);
|
const driver = requireEngineDriver(connection);
|
||||||
|
|
||||||
|
if (!connection.port && driver.defaultPort) {
|
||||||
|
connection.port = driver.defaultPort.toString();
|
||||||
|
}
|
||||||
|
|
||||||
if (connection.useSshTunnel) {
|
if (connection.useSshTunnel) {
|
||||||
const tunnel = await getSshTunnel(connection);
|
const tunnel = await getSshTunnel(connection);
|
||||||
if (tunnel.state == 'error') {
|
if (tunnel.state == 'error') {
|
||||||
throw new Error(tunnel.message);
|
throw new Error(tunnel.message);
|
||||||
}
|
}
|
||||||
|
|
||||||
connection = {
|
connection.server = tunnel.localHost;
|
||||||
...connection,
|
connection.port = tunnel.localPort;
|
||||||
server: tunnel.localHost,
|
|
||||||
port: tunnel.localPort,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const settingsValue = await config.getSettings();
|
const settingsValue = await config.getSettings();
|
||||||
|
|||||||
@@ -96,7 +96,9 @@ async function connectUtility(driver, storedConnection, connectionMode, addition
|
|||||||
...decryptConnection(connectionLoaded),
|
...decryptConnection(connectionLoaded),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!connection.port && driver.defaultPort) connection.port = driver.defaultPort.toString();
|
if (!connection.port && driver.defaultPort) {
|
||||||
|
connection.port = driver.defaultPort.toString();
|
||||||
|
}
|
||||||
|
|
||||||
if (connection.useSshTunnel) {
|
if (connection.useSshTunnel) {
|
||||||
const tunnel = await getSshTunnelProxy(connection);
|
const tunnel = await getSshTunnelProxy(connection);
|
||||||
|
|||||||
Reference in New Issue
Block a user