Skip to content

Commit

Permalink
Update 1-connecting.mdx
Browse files Browse the repository at this point in the history
Documentation should mention supported feature.

brianc/node-postgres#2513
  • Loading branch information
JoelVenable authored Apr 8, 2021
1 parent 40393b8 commit d5db1ea
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions content/features/1-connecting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,20 @@ client.query('SELECT NOW()', (err, res) => {
})
```

Many cloud providers also provide alternative methods of connecting to database instances using short-lived authentication tokens. node-postgres supports dynamic passwords via a callback function, either synchronous or asynchronous. The callback function must resolve to a string.

```
const pool = new pg.Pool({
host: 'db.example.com',
port: 5432,
user: 'user',
database: 'my-db',
password: async () => 'random-' + Date.now(),
});
```

### Programmatic Connection to Sockets

Connections to unix sockets can also be made. This can be useful on distros like Ubuntu, where authentication is managed via the socket connection instead of a password.
Expand Down

0 comments on commit d5db1ea

Please sign in to comment.