Skip to content

Commit

Permalink
docs(client): update README with new params
Browse files Browse the repository at this point in the history
  • Loading branch information
alonsovb committed Jan 18, 2024
1 parent f9efb3b commit 5f675de
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions presto-client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ The Presto client can be configured with the following parameters:
- `schema`: The default schema to use for queries. (Default: `undefined`)
- `source`: The name of the source you want to use for reporting purposes (Default: `presto-js-client`)
- `timezone`: The timezone to use for queries. (Default: `undefined`)
- `authorizationToken`: The value to send as-is in the Authorization header. (Default: `undefined`)
- `basicAuthentication`: An object with a user and password inside, to be used for basic authentication. (Default: `undefined`)
- `extraHeaders`: An dictionary of key-values to send as extra headers in all requests to the API. (Default: `undefined`)
- `interval`: (DEPRECATED) The interval in milliseconds between checks for the status of a running query. (Default: `100`)

## Querying
Expand Down
6 changes: 3 additions & 3 deletions presto-client/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class PrestoClient {
* @param {string} config.user - The username to be used for the Presto session.
*/
constructor({
basicAuthorization,
basicAuthentication,
authorizationToken,
catalog,
extraHeaders,
Expand Down Expand Up @@ -65,10 +65,10 @@ export class PrestoClient {

if (authorizationToken) {
this.headers['Authorization'] = authorizationToken
} else if (basicAuthorization) {
} else if (basicAuthentication) {
// Note this is only available for Node.js
this.headers['Authorization'] = `Bearer ${Buffer.from(
`${basicAuthorization.user}:${basicAuthorization.password}`,
`${basicAuthentication.user}:${basicAuthentication.password}`,
).toString('base64')}`
}

Expand Down
2 changes: 1 addition & 1 deletion presto-client/src/client.types.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export interface PrestoClientConfig {
authorizationToken?: string
basicAuthorization?: {
basicAuthentication?: {
user: string
password: string
}
Expand Down

0 comments on commit 5f675de

Please sign in to comment.