Skip to content

Commit

Permalink
style: rename apiKey input arg to serviceKey
Browse files Browse the repository at this point in the history
  • Loading branch information
wrn14897 committed Jun 26, 2024
1 parent f7183db commit 5d5fff5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ program.name('@hyperdx/cli').description('HyperDX Command Line Interface');

program
.command('upload-sourcemaps')
.option('-k, --apiKey <string>', 'The HyperDX personal api access key')
.option('-k, --serviceKey <string>', 'The HyperDX service account API key')
.option(
'-u, --apiUrl [string]',
'An optional api url for self-hosted deployments',
Expand Down
16 changes: 8 additions & 8 deletions packages/cli/src/lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}

Expand All @@ -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())
Expand All @@ -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}`);
Expand All @@ -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,
Expand Down

0 comments on commit 5d5fff5

Please sign in to comment.