mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 10:16:00 +00:00
fixed mongoUrl regression
This commit is contained in:
@@ -47,17 +47,20 @@ async function getScriptableDb(pool) {
|
||||
const driver = {
|
||||
...driverBase,
|
||||
analyserClass: Analyser,
|
||||
async connect({ server, port, user, password, database, useDatabaseUrl, databaseUrl, ssl }) {
|
||||
async connect({ server, port, user, password, database, useDatabaseUrl, databaseUrl, ssl, useSshTunnel }) {
|
||||
let mongoUrl;
|
||||
|
||||
if (useDatabaseUrl) {
|
||||
// change port to ssh tunnel port
|
||||
const url = new URL(databaseUrl);
|
||||
url.port = port;
|
||||
mongoUrl = url.href;
|
||||
if (useSshTunnel) {
|
||||
// change port to ssh tunnel port
|
||||
const url = new URL(databaseUrl);
|
||||
url.port = port;
|
||||
mongoUrl = url.href;
|
||||
} else {
|
||||
mongoUrl = databaseUrl;
|
||||
}
|
||||
} else {
|
||||
mongoUrl = user
|
||||
? `mongodb://${user}:${password}@${server}:${port}`
|
||||
: `mongodb://${server}:${port}`;
|
||||
mongoUrl = user ? `mongodb://${user}:${password}@${server}:${port}` : `mongodb://${server}:${port}`;
|
||||
}
|
||||
|
||||
const options = {
|
||||
|
||||
Reference in New Issue
Block a user