Skip to content

Commit

Permalink
feat: set host from opt [] (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Stoyanov authored Feb 13, 2023
1 parent 0a027bf commit 4353c2b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/keys/get-management-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export interface GetManagementTokenOptions {
environmentId: string
keyId?: string
reuseToken?: boolean
host?: string
}

let defaultCache: NodeCache
Expand Down Expand Up @@ -143,9 +144,11 @@ export const getManagementToken = (privateKey: string, opts: GetManagementTokenO
if ((opts.reuseToken || opts.reuseToken === undefined) && !defaultCache) {
defaultCache = new NodeCache()
}
const httpClientOpts = typeof opts.host !== 'undefined' ? { prefixUrl: opts.host } : {}

return createGetManagementToken(
createLogger({ filename: __filename }),
createHttpClient(),
createHttpClient(httpClientOpts),
defaultCache
)(privateKey, opts)
}

0 comments on commit 4353c2b

Please sign in to comment.