Skip to content
This repository has been archived by the owner on Jul 14, 2023. It is now read-only.

Commit

Permalink
fix: mapcf username to pg user (#10)
Browse files Browse the repository at this point in the history
* fix: map Cloud Foundry username to pg user

* refactor: directly change this.options.credentials
  • Loading branch information
gregorwolf authored Aug 24, 2020
1 parent 1b751c3 commit d00a6d8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion __tests__/odata.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('OData to Postgres dialect', () => {
host: 'localhost',
port: '5432',
database: 'beershop',
user: 'postgres',
username: 'postgres',
password: 'postgres',
},
})
Expand Down
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ module.exports = class PostgresDatabase extends HanaDatabase {
constructor(...args) {
super(...args)
// maybe do more stuff
// Cloud Foundry provides the user in the field username the pg npm module expects user
if (this.options.credentials && this.options.credentials.username) {
this.options.credentials.user = this.options.credentials.username
}
this._pool = new Pool(this.options.credentials)
}

Expand Down

0 comments on commit d00a6d8

Please sign in to comment.