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