Merge remote-tracking branch 'origin/main' into fix/address-azure-sql-server-dynamic-secret-integration

This commit is contained in:
Sheen Capadngan
2025-09-10 21:35:23 +08:00
@@ -167,10 +167,9 @@ export const SqlDatabaseProvider = ({ gatewayService }: TSqlDatabaseProviderDTO)
"user@<azure-server-name>" so Azure opens the correct logical server. "user@<azure-server-name>" so Azure opens the correct logical server.
Direct connections to the Azure FQDN usually don’t require this suffix. Direct connections to the Azure FQDN usually don’t require this suffix.
*/ */
const isGatewayForwardedTraffic = providerInputs.host === "localhost";
const isAzureSql = isMsSQLClient && new RE2(/\.database\.windows\.net$/i).test(providerInputs.originalHost); const isAzureSql = isMsSQLClient && new RE2(/\.database\.windows\.net$/i).test(providerInputs.originalHost);
const azureServerLabel = const azureServerLabel =
isAzureSql && isGatewayForwardedTraffic ? providerInputs.originalHost?.split(".")[0] : undefined; isAzureSql && providerInputs.gatewayId ? providerInputs.originalHost?.split(".")[0] : undefined;
const effectiveUser = const effectiveUser =
isAzureSql && !providerInputs.username.includes("@") isAzureSql && !providerInputs.username.includes("@")
? `${providerInputs.username}@${azureServerLabel}` ? `${providerInputs.username}@${azureServerLabel}`
@@ -181,7 +180,10 @@ export const SqlDatabaseProvider = ({ gatewayService }: TSqlDatabaseProviderDTO)
connection: { connection: {
database: providerInputs.database, database: providerInputs.database,
port: providerInputs.port, port: providerInputs.port,
host: providerInputs.client === SqlProviders.Postgres ? providerInputs.hostIp : providerInputs.host, host:
providerInputs.client === SqlProviders.Postgres && !providerInputs.gatewayId
? providerInputs.hostIp
: providerInputs.host,
user: effectiveUser, user: effectiveUser,
password: providerInputs.password, password: providerInputs.password,
ssl, ssl,