Skip to content

Commit 72ad2ff

Browse files
authored
style: rename apiKey input arg to serviceKey (#162)
1 parent f84fd61 commit 72ad2ff

File tree

4 files changed

+17
-12
lines changed

4 files changed

+17
-12
lines changed

.changeset/spicy-waves-rule.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@hyperdx/cli': patch
3+
---
4+
5+
style: rename apiKey input arg to serviceKey

packages/cli/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
In your build pipeline, you will need to run the CLI tool. Here's how to run it:
66

77
```sh
8-
npx @hyperdx/cli upload-sourcemaps --path="/path/to/sourcemaps" --apiKey="your-api-key"
8+
npx @hyperdx/cli upload-sourcemaps --path="/path/to/sourcemaps" --serviceKey="your-service-account-api-key"
99
```
1010

1111
You can also add this as an npm script
@@ -20,7 +20,7 @@ You can also add this as an npm script
2020
}
2121
```
2222

23-
Optionally, you can set the `HYPERDX_API_ACCESS_KEY` environment variable to avoid passing the `apiKey` flag.
23+
Optionally, you can set the `HYPERDX_SERVICE_KEY` environment variable to avoid passing the `serviceKey` flag.
2424

2525
## Contributing
2626

packages/cli/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ program.name('@hyperdx/cli').description('HyperDX Command Line Interface');
66

77
program
88
.command('upload-sourcemaps')
9-
.option('-k, --apiKey <string>', 'The HyperDX personal api access key')
9+
.option('-k, --serviceKey <string>', 'The HyperDX service account API key')
1010
.option(
1111
'-u, --apiUrl [string]',
1212
'An optional api url for self-hosted deployments',

packages/cli/src/lib.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,24 @@ const pj = require('../package.json');
99

1010
export const uploadSourcemaps = async ({
1111
allowNoop,
12-
apiKey,
12+
serviceKey,
1313
apiUrl,
1414
basePath,
1515
path,
1616
releaseId,
1717
}: {
1818
allowNoop?: boolean;
19-
apiKey: string;
19+
serviceKey: string;
2020
apiUrl?: string;
2121
basePath?: string;
2222
path: string;
2323
releaseId?: string;
2424
}) => {
25-
if (!apiKey || apiKey === '') {
26-
if (process.env.HYPERDX_API_ACCESS_KEY) {
27-
apiKey = process.env.HYPERDX_API_ACCESS_KEY;
25+
if (!serviceKey || serviceKey === '') {
26+
if (process.env.HYPERDX_SERVICE_KEY) {
27+
serviceKey = process.env.HYPERDX_SERVICE_KEY;
2828
} else {
29-
throw new Error('api key cannot be empty');
29+
throw new Error('service key cannot be empty');
3030
}
3131
}
3232

@@ -36,7 +36,7 @@ export const uploadSourcemaps = async ({
3636
method: 'get',
3737
headers: {
3838
'Content-Type': 'application/json',
39-
Authorization: `Bearer ${apiKey}`,
39+
Authorization: `Bearer ${serviceKey}`,
4040
},
4141
})
4242
.then((response) => response.json())
@@ -49,7 +49,7 @@ export const uploadSourcemaps = async ({
4949

5050
const teamId = res?.user?.team;
5151
if (!teamId) {
52-
throw new Error('invalid api key');
52+
throw new Error('invalid service key');
5353
}
5454

5555
console.info(`Starting to upload source maps from ${path}`);
@@ -76,7 +76,7 @@ export const uploadSourcemaps = async ({
7676
method: 'post',
7777
headers: {
7878
'Content-Type': 'application/json',
79-
Authorization: `Bearer ${apiKey}`,
79+
Authorization: `Bearer ${serviceKey}`,
8080
},
8181
body: JSON.stringify({
8282
pkgVersion: pj.version,

0 commit comments

Comments
 (0)