fix: disable TLS encryption by default to avoid ServerName IP address warning

- Set encrypt: false as default for SQL Server connections
- Fixes DEP0123 deprecation warning when connecting via IP address (VPN tunnel)
- trustServerCertificate option still configurable via environment variable
- Affects 6 files: sql-server.ts, bip-users-dao.ts, database/index.ts,
  database/data-source.ts, cleaner-handler.ts, validation-handler.ts
This commit is contained in:
Misaka_Company
2026-03-04 16:53:58 +08:00
parent a06276127d
commit 2f5dc7607d
6 changed files with 7 additions and 7 deletions

View File

@@ -40,7 +40,7 @@ function buildDataSourceOptions(): DataSourceOptions {
password: process.env.DB_PASSWORD || '',
database: process.env.DB_NAME || '',
options: {
encrypt: process.env.DB_TRUST_SERVER_CERTIFICATE === 'yes',
encrypt: false,
trustServerCertificate: process.env.DB_TRUST_SERVER_CERTIFICATE === 'yes'
},
...commonOptions

View File

@@ -57,7 +57,7 @@ export function createSqlServerConfig(): SqlServerConfig {
password: process.env.DB_PASSWORD || '',
database: process.env.DB_NAME || '',
options: {
encrypt: process.env.DB_TRUST_SERVER_CERTIFICATE === 'yes',
encrypt: false,
trustServerCertificate: process.env.DB_TRUST_SERVER_CERTIFICATE === 'yes'
}
}

View File

@@ -35,7 +35,7 @@ export class SqlServerService implements IDatabaseService {
password: this.config.password,
database: this.config.database,
options: {
encrypt: this.config.options?.encrypt ?? true,
encrypt: this.config.options?.encrypt ?? false,
trustServerCertificate: this.config.options?.trustServerCertificate ?? false
}
}