trust server certificate option #305

This commit is contained in:
Jan Prochazka 2022-07-14 14:03:50 +02:00
parent 1a90729f66
commit 755781bca6
3 changed files with 8 additions and 2 deletions

View File

@ -168,6 +168,10 @@
<FormCheckboxField label="Is read only" name="isReadOnly" disabled={isConnected} />
{/if}
{#if driver?.showConnectionField('trustServerCertificate', $values)}
<FormCheckboxField label="Trust server certificate" name="trustServerCertificate" disabled={isConnected} />
{/if}
{#if driver?.showConnectionField('defaultDatabase', $values)}
<FormTextField label="Default database" name="defaultDatabase" disabled={isConnected} />
{/if}

View File

@ -22,7 +22,7 @@ function extractTediousColumns(columns, addDriverNativeColumn = false) {
return res;
}
async function tediousConnect({ server, port, user, password, database, ssl }) {
async function tediousConnect({ server, port, user, password, database, ssl, trustServerCertificate }) {
return new Promise((resolve, reject) => {
const connectionOptions = {
encrypt: !!ssl,
@ -32,6 +32,7 @@ async function tediousConnect({ server, port, user, password, database, ssl }) {
validateBulkLoadParameters: false,
requestTimeout: 1000 * 3600,
port: port ? parseInt(port) : undefined,
trustServerCertificate: !!trustServerCertificate,
};
if (database) {

View File

@ -126,7 +126,8 @@ const driver = {
showConnectionField: (field, values) =>
['authType', 'server', 'port', 'user', 'password', 'defaultDatabase', 'singleDatabase', 'isReadOnly'].includes(
field
),
) ||
(field == 'trustServerCertificate' && values.authType != 'sql' && values.authType != 'sspi'),
getQuerySplitterOptions: () => mssqlSplitterOptions,
engine: 'mssql@dbgate-plugin-mssql',