From 45b980cf7fd61b0ee2e9560d9aadb96ce331d5cb Mon Sep 17 00:00:00 2001 From: Umed Khudoiberdiev Date: Tue, 29 Sep 2020 21:40:16 +0500 Subject: [PATCH] Revert "fix: properly override database url properties (#6247)" (#6802) This reverts commit 0ba2a48efdf18977ff5df55b950e763255c75ffc. --- src/driver/DriverUtils.ts | 2 +- test/github-issues/4878/issue-4878.ts | 19 ------------------- 2 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 test/github-issues/4878/issue-4878.ts diff --git a/src/driver/DriverUtils.ts b/src/driver/DriverUtils.ts index 56d7309d9f..f6da56b564 100644 --- a/src/driver/DriverUtils.ts +++ b/src/driver/DriverUtils.ts @@ -28,7 +28,7 @@ export class DriverUtils { if (buildOptions && buildOptions.useSid) { urlDriverOptions.sid = parsedUrl.database; } - return Object.assign({}, urlDriverOptions, options); + return Object.assign({}, options, urlDriverOptions); } return Object.assign({}, options); } diff --git a/test/github-issues/4878/issue-4878.ts b/test/github-issues/4878/issue-4878.ts deleted file mode 100644 index 8359d8b0ed..0000000000 --- a/test/github-issues/4878/issue-4878.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { DriverUtils } from "../../../src/driver/DriverUtils"; -import { expect } from "chai"; - -describe("github issues > #4878 URL Connection string not overridden by supplied options", () => { - it("should override url-built options with user-supplied options", () => { - const obj: any = { - username: "user", - password: "password", - host: "host", - database: "database", - port: 8888 - }; - - const url = `postgres://url_user:${obj.password}@${obj.host}:${obj.port}/${obj.database}`; - obj.url = url; - const options = DriverUtils.buildDriverOptions(obj); - expect(options.username).to.eql(obj.username); - }); -});