mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-20 13:36:02 +00:00
fix: connection ssl require file path instread of file content
This commit is contained in:
@@ -62,14 +62,17 @@ async function connectUtility(driver, storedConnection, connectionMode, addition
|
|||||||
|
|
||||||
if (connection.sslCaFile) {
|
if (connection.sslCaFile) {
|
||||||
connection.ssl.ca = await fs.readFile(connection.sslCaFile);
|
connection.ssl.ca = await fs.readFile(connection.sslCaFile);
|
||||||
|
connection.ssl.sslCaFile = connection.sslCaFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection.sslCertFile) {
|
if (connection.sslCertFile) {
|
||||||
connection.ssl.cert = await fs.readFile(connection.sslCertFile);
|
connection.ssl.cert = await fs.readFile(connection.sslCertFile);
|
||||||
|
connection.ssl.sslCertFile = connection.sslCertFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection.sslKeyFile) {
|
if (connection.sslKeyFile) {
|
||||||
connection.ssl.key = await fs.readFile(connection.sslKeyFile);
|
connection.ssl.key = await fs.readFile(connection.sslKeyFile);
|
||||||
|
connection.ssl.sslKeyFile = connection.sslKeyFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (connection.sslCertFilePassword) {
|
if (connection.sslCertFilePassword) {
|
||||||
|
|||||||
@@ -68,10 +68,11 @@ const driver = {
|
|||||||
};
|
};
|
||||||
if (ssl) {
|
if (ssl) {
|
||||||
options.tls = true;
|
options.tls = true;
|
||||||
options.tlsCAFile = ssl.ca;
|
options.tlsCAFile = ssl.sslCaFile;
|
||||||
options.tlsCertificateKeyFile = ssl.cert || ssl.key;
|
options.tlsCertificateKeyFile = ssl.sslCertFile || ssl.sslKeyFile;
|
||||||
options.tlsCertificateKeyFilePassword = ssl.password;
|
options.tlsCertificateKeyFilePassword = ssl.password;
|
||||||
options.tlsAllowInvalidCertificates = !ssl.rejectUnauthorized;
|
options.tlsAllowInvalidCertificates = !ssl.rejectUnauthorized;
|
||||||
|
options.tlsInsecure = !ssl.rejectUnauthorized;
|
||||||
}
|
}
|
||||||
|
|
||||||
const pool = new MongoClient(mongoUrl, options);
|
const pool = new MongoClient(mongoUrl, options);
|
||||||
|
|||||||
Reference in New Issue
Block a user