Skip to content

Commit

Permalink
HCK-8611: server Instance (#117)
Browse files Browse the repository at this point in the history
* fix: handle the case when the Instance is in server param

* chore: sonar
  • Loading branch information
chulanovskyi-bs authored Oct 31, 2024
1 parent 374e600 commit bc309e5
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions reverse_engineering/helpers/parseConnectionString.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,15 @@ const parseSqlServerUrl = ({ url = '' }) => {
// example: Server=tcp:synapseworkspace.sql.azuresynapse.net,1433;Database=SampleDB;Authentication=Active Directory Password;User [email protected];Password=password;Encrypt=true;TrustServerCertificate=false;Connection Timeout=30;
const parseBasicString = ({ string = '' }) => {
const parsed = ConnectionPool.parseConnectionString(string);

const serverRegex = /Server=(?:[a-z]+:)?([^,;]+)(?:,\d+)?/i;
const match = serverRegex.exec(string);
const host = match ? match[1] : parsed.server;

return {
databaseName: parsed.database,
host: parsed.server,
host: host,
port: parsed.port,
databaseName: parsed.database,
userName: parsed.user,
userPassword: parsed.password,
};
Expand Down

0 comments on commit bc309e5

Please sign in to comment.