mirror of
https://github.com/dbgate/dbgate
synced 2024-11-21 23:39:46 +00:00
mssql tedious fix #236
This commit is contained in:
parent
50f9b9f025
commit
bfea77c56b
@ -5,6 +5,7 @@ services:
|
||||
dbgate:
|
||||
build: docker
|
||||
# image: dbgate/dbgate:beta-alpine
|
||||
# image: dbgate/dbgate:beta
|
||||
restart: always
|
||||
ports:
|
||||
- 3100:3000
|
||||
@ -17,6 +18,13 @@ services:
|
||||
environment:
|
||||
WEB_ROOT: /dbgate
|
||||
|
||||
# CONNECTIONS: mssql
|
||||
# LABEL_mssql: MS Sql
|
||||
# SERVER_mssql: mssql
|
||||
# USER_mssql: sa
|
||||
# PORT_mssql: 1433
|
||||
# PASSWORD_mssql: Pwd2020Db
|
||||
# ENGINE_mssql: mssql@dbgate-plugin-mssql
|
||||
proxy:
|
||||
# image: nginx
|
||||
build: test/nginx
|
||||
@ -32,6 +40,14 @@ services:
|
||||
# FILE_sqlite: /mnt/sqt/Chinook.db
|
||||
# ENGINE_sqlite: sqlite@dbgate-plugin-sqlite
|
||||
|
||||
# mssql:
|
||||
# image: mcr.microsoft.com/mssql/server
|
||||
# restart: always
|
||||
# environment:
|
||||
# - ACCEPT_EULA=Y
|
||||
# - SA_PASSWORD=Pwd2020Db
|
||||
# - MSSQL_PID=Express
|
||||
|
||||
volumes:
|
||||
dbgate-data:
|
||||
driver: local
|
@ -24,6 +24,20 @@ function extractTediousColumns(columns, addDriverNativeColumn = false) {
|
||||
|
||||
async function tediousConnect({ server, port, user, password, database, ssl }) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const connectionOptions = {
|
||||
encrypt: !!ssl,
|
||||
cryptoCredentialsDetails: ssl ? _.pick(ssl, ['ca', 'cert', 'key']) : undefined,
|
||||
trustServerCertificate: ssl ? (!ssl.ca && !ssl.cert && !ssl.key ? true : ssl.rejectUnauthorized) : undefined,
|
||||
enableArithAbort: true,
|
||||
validateBulkLoadParameters: false,
|
||||
requestTimeout: 1000 * 3600,
|
||||
port: port ? parseInt(port) : undefined,
|
||||
};
|
||||
|
||||
if (database) {
|
||||
connectionOptions.database = database;
|
||||
}
|
||||
|
||||
const connection = new tedious.Connection({
|
||||
server,
|
||||
|
||||
@ -35,16 +49,7 @@ async function tediousConnect({ server, port, user, password, database, ssl }) {
|
||||
},
|
||||
},
|
||||
|
||||
options: {
|
||||
encrypt: !!ssl,
|
||||
cryptoCredentialsDetails: ssl ? _.pick(ssl, ['ca', 'cert', 'key']) : undefined,
|
||||
trustServerCertificate: ssl ? (!ssl.ca && !ssl.cert && !ssl.key ? true : ssl.rejectUnauthorized) : undefined,
|
||||
enableArithAbort: true,
|
||||
validateBulkLoadParameters: false,
|
||||
requestTimeout: 1000 * 3600,
|
||||
database,
|
||||
port: port ? parseInt(port) : undefined,
|
||||
},
|
||||
options: connectionOptions,
|
||||
});
|
||||
connection.on('connect', function (err) {
|
||||
if (err) {
|
||||
|
Loading…
Reference in New Issue
Block a user