Skip to content

Commit

Permalink
Merge pull request #1381 from mShan0/mshan0-issue1361
Browse files Browse the repository at this point in the history
feat: deprecate default value for trustServerCertificate
  • Loading branch information
mShan0 authored Jan 12, 2022
2 parents b2d0fa2 + ea7f990 commit 212c68e
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,15 @@ import { version } from '../package.json';
import { URL } from 'url';
import { AttentionTokenHandler, InitialSqlTokenHandler, Login7TokenHandler, RequestTokenHandler, TokenHandler } from './token/handler';

let trustServerWarningEmitted = false;

const emitTrustServerCertificateWarning = () => {
if (!trustServerWarningEmitted) {
trustServerWarningEmitted = true;
process.emitWarning('`config.options.trustServerCertificate` will default to false in the future. To silence this message, specify a value explicitly in the config options');
}
};

type BeginTransactionCallback =
/**
* The callback is called when the request to start the transaction has completed,
Expand Down Expand Up @@ -1604,6 +1613,8 @@ class Connection extends EventEmitter {
}

this.config.options.trustServerCertificate = config.options.trustServerCertificate;
} else {
emitTrustServerCertificateWarning();
}

if (config.options.useColumnNames !== undefined) {
Expand Down

0 comments on commit 212c68e

Please sign in to comment.