Only enable trust server certificate if encryption enabled.
This commit is contained in:
parent
7b6246ee59
commit
63d16f1809
|
@ -184,15 +184,18 @@ class SqlServerIntegration extends Sql implements DatasourcePlus {
|
||||||
|
|
||||||
async connect() {
|
async connect() {
|
||||||
try {
|
try {
|
||||||
|
const encrypt = this.config.encrypt
|
||||||
const clientCfg: MSSQLConfig & sqlServer.config = {
|
const clientCfg: MSSQLConfig & sqlServer.config = {
|
||||||
...this.config,
|
...this.config,
|
||||||
port: +this.config.port,
|
port: +this.config.port,
|
||||||
options: {
|
options: {
|
||||||
encrypt: this.config.encrypt,
|
encrypt: encrypt,
|
||||||
enableArithAbort: true,
|
enableArithAbort: true,
|
||||||
trustServerCertificate: true,
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
if (encrypt) {
|
||||||
|
clientCfg.options!.trustServerCertificate = true
|
||||||
|
}
|
||||||
delete clientCfg.encrypt
|
delete clientCfg.encrypt
|
||||||
|
|
||||||
if (this.config.authType === MSSQLConfigAuthType.ACTIVE_DIRECTORY) {
|
if (this.config.authType === MSSQLConfigAuthType.ACTIVE_DIRECTORY) {
|
||||||
|
|
Loading…
Reference in New Issue