From 5d5fff5170e186e83831afcf7a5221a1aea0b318 Mon Sep 17 00:00:00 2001 From: Warren <5959690+wrn14897@users.noreply.github.com> Date: Wed, 26 Jun 2024 16:34:24 -0700 Subject: [PATCH] style: rename apiKey input arg to serviceKey --- packages/cli/src/index.ts | 2 +- packages/cli/src/lib.ts | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 4e1a5877..cc30d2b7 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -6,7 +6,7 @@ program.name('@hyperdx/cli').description('HyperDX Command Line Interface'); program .command('upload-sourcemaps') - .option('-k, --apiKey ', 'The HyperDX personal api access key') + .option('-k, --serviceKey ', 'The HyperDX service account API key') .option( '-u, --apiUrl [string]', 'An optional api url for self-hosted deployments', diff --git a/packages/cli/src/lib.ts b/packages/cli/src/lib.ts index ac0bad05..638cdfa4 100644 --- a/packages/cli/src/lib.ts +++ b/packages/cli/src/lib.ts @@ -9,24 +9,24 @@ const pj = require('../package.json'); export const uploadSourcemaps = async ({ allowNoop, - apiKey, + serviceKey, apiUrl, basePath, path, releaseId, }: { allowNoop?: boolean; - apiKey: string; + serviceKey: string; apiUrl?: string; basePath?: string; path: string; releaseId?: string; }) => { - if (!apiKey || apiKey === '') { + if (!serviceKey || serviceKey === '') { if (process.env.HYPERDX_API_ACCESS_KEY) { - apiKey = process.env.HYPERDX_API_ACCESS_KEY; + serviceKey = process.env.HYPERDX_API_ACCESS_KEY; } else { - throw new Error('api key cannot be empty'); + throw new Error('service key cannot be empty'); } } @@ -36,7 +36,7 @@ export const uploadSourcemaps = async ({ method: 'get', headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${apiKey}`, + Authorization: `Bearer ${serviceKey}`, }, }) .then((response) => response.json()) @@ -49,7 +49,7 @@ export const uploadSourcemaps = async ({ const teamId = res?.user?.team; if (!teamId) { - throw new Error('invalid api key'); + throw new Error('invalid service key'); } console.info(`Starting to upload source maps from ${path}`); @@ -76,7 +76,7 @@ export const uploadSourcemaps = async ({ method: 'post', headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${apiKey}`, + Authorization: `Bearer ${serviceKey}`, }, body: JSON.stringify({ pkgVersion: pj.version,