Skip to content

Commit 70c98e0

Browse files
feat(api): Update env var name
1 parent 69968b1 commit 70c98e0

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 42
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/imagekit-inc%2Fimagekit-d1a3e6dfc45ae832b6b14a0aef25878985c679fa9f48c1470df188b1578ba648.yml
33
openapi_spec_hash: 1d382866fce3284f26d341f112988d9d
4-
config_hash: 51a9632be24fc533ad69a5bd56934651
4+
config_hash: f1fafe5e607e996b58b67fd1dd3e74fa

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ The full API of this library can be found in [api.md](api.md).
2626
import ImageKit from '@imagekit/nodejs';
2727

2828
const client = new ImageKit({
29-
privateKey: process.env['IMAGEKIT_PRIVATE_API_KEY'], // This is the default and can be omitted
29+
privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted
3030
password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted
3131
});
3232

@@ -47,7 +47,7 @@ This library includes TypeScript definitions for all request params and response
4747
import ImageKit from '@imagekit/nodejs';
4848

4949
const client = new ImageKit({
50-
privateKey: process.env['IMAGEKIT_PRIVATE_API_KEY'], // This is the default and can be omitted
50+
privateKey: process.env['IMAGEKIT_PRIVATE_KEY'], // This is the default and can be omitted
5151
password: process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'], // This is the default and can be omitted
5252
});
5353

packages/mcp-server/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ cd imagekit-nodejs
1919

2020
```sh
2121
# set env vars as needed
22-
export IMAGEKIT_PRIVATE_API_KEY="My Private Key"
22+
export IMAGEKIT_PRIVATE_KEY="My Private Key"
2323
export OPTIONAL_IMAGEKIT_IGNORES_THIS="My Password"
2424
export IMAGEKIT_WEBHOOK_SECRET="My Webhook Secret"
2525
node ./packages/mcp-server/dist/index.js
@@ -44,7 +44,7 @@ For clients with a configuration JSON, it might look something like this:
4444
"command": "node",
4545
"args": ["/path/to/local/imagekit-nodejs/packages/mcp-server", "--client=claude", "--tools=dynamic"],
4646
"env": {
47-
"IMAGEKIT_PRIVATE_API_KEY": "My Private Key",
47+
"IMAGEKIT_PRIVATE_KEY": "My Private Key",
4848
"OPTIONAL_IMAGEKIT_IGNORES_THIS": "My Password",
4949
"IMAGEKIT_WEBHOOK_SECRET": "My Webhook Secret"
5050
}
@@ -154,7 +154,7 @@ Authorization can be provided via the `Authorization` header using the Basic sch
154154
Additionally, authorization can be provided via the following headers:
155155
| Header | Equivalent client option | Security scheme |
156156
| ---------------------------------- | ------------------------ | --------------- |
157-
| `x-imagekit-private-api-key` | `privateKey` | basicAuth |
157+
| `x-imagekit-private-key` | `privateKey` | basicAuth |
158158
| `x-optional-imagekit-ignores-this` | `password` | basicAuth |
159159

160160
A configuration JSON for this server might look like this, assuming the server is hosted at `http://localhost:3000`:

packages/mcp-server/manifest.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
"command": "node",
2121
"args": ["${__dirname}/index.js"],
2222
"env": {
23-
"IMAGEKIT_PRIVATE_API_KEY": "${user_config.IMAGEKIT_PRIVATE_API_KEY}",
23+
"IMAGEKIT_PRIVATE_KEY": "${user_config.IMAGEKIT_PRIVATE_KEY}",
2424
"OPTIONAL_IMAGEKIT_IGNORES_THIS": "${user_config.OPTIONAL_IMAGEKIT_IGNORES_THIS}",
2525
"IMAGEKIT_WEBHOOK_SECRET": "${user_config.IMAGEKIT_WEBHOOK_SECRET}"
2626
}
2727
}
2828
},
2929
"user_config": {
30-
"IMAGEKIT_PRIVATE_API_KEY": {
30+
"IMAGEKIT_PRIVATE_KEY": {
3131
"title": "private_key",
3232
"description": "Your ImageKit private API key (starts with `private_`).\nYou can find this in the [ImageKit dashboard](https://imagekit.io/dashboard/developer/api-keys).\n",
3333
"required": true,

packages/mcp-server/src/headers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ export const parseAuthHeaders = (req: IncomingMessage): Partial<ClientOptions> =
2020
}
2121

2222
const privateKey =
23-
Array.isArray(req.headers['x-imagekit-private-api-key']) ?
24-
req.headers['x-imagekit-private-api-key'][0]
25-
: req.headers['x-imagekit-private-api-key'];
23+
Array.isArray(req.headers['x-imagekit-private-key']) ?
24+
req.headers['x-imagekit-private-key'][0]
25+
: req.headers['x-imagekit-private-key'];
2626
const password =
2727
Array.isArray(req.headers['x-optional-imagekit-ignores-this']) ?
2828
req.headers['x-optional-imagekit-ignores-this'][0]

src/client.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export class ImageKit {
201201
/**
202202
* API Client for interfacing with the Image Kit API.
203203
*
204-
* @param {string | undefined} [opts.privateKey=process.env['IMAGEKIT_PRIVATE_API_KEY'] ?? undefined]
204+
* @param {string | undefined} [opts.privateKey=process.env['IMAGEKIT_PRIVATE_KEY'] ?? undefined]
205205
* @param {string | null | undefined} [opts.password=process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'] ?? do_not_set]
206206
* @param {string | null | undefined} [opts.webhookSecret=process.env['IMAGEKIT_WEBHOOK_SECRET'] ?? null]
207207
* @param {string} [opts.baseURL=process.env['IMAGE_KIT_BASE_URL'] ?? https://api.imagekit.io] - Override the default base URL for the API.
@@ -214,14 +214,14 @@ export class ImageKit {
214214
*/
215215
constructor({
216216
baseURL = readEnv('IMAGE_KIT_BASE_URL'),
217-
privateKey = readEnv('IMAGEKIT_PRIVATE_API_KEY'),
217+
privateKey = readEnv('IMAGEKIT_PRIVATE_KEY'),
218218
password = readEnv('OPTIONAL_IMAGEKIT_IGNORES_THIS') ?? 'do_not_set',
219219
webhookSecret = readEnv('IMAGEKIT_WEBHOOK_SECRET') ?? null,
220220
...opts
221221
}: ClientOptions = {}) {
222222
if (privateKey === undefined) {
223223
throw new Errors.ImageKitError(
224-
"The IMAGEKIT_PRIVATE_API_KEY environment variable is missing or empty; either provide it, or instantiate the ImageKit client with an privateKey option, like new ImageKit({ privateKey: 'My Private Key' }).",
224+
"The IMAGEKIT_PRIVATE_KEY environment variable is missing or empty; either provide it, or instantiate the ImageKit client with an privateKey option, like new ImageKit({ privateKey: 'My Private Key' }).",
225225
);
226226
}
227227

tests/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ describe('instantiate client', () => {
472472

473473
test('with environment variable arguments', () => {
474474
// set options via env var
475-
process.env['IMAGEKIT_PRIVATE_API_KEY'] = 'My Private Key';
475+
process.env['IMAGEKIT_PRIVATE_KEY'] = 'My Private Key';
476476
process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'] = 'My Password';
477477
const client = new ImageKit();
478478
expect(client.privateKey).toBe('My Private Key');
@@ -481,7 +481,7 @@ describe('instantiate client', () => {
481481

482482
test('with overridden environment variable arguments', () => {
483483
// set options via env var
484-
process.env['IMAGEKIT_PRIVATE_API_KEY'] = 'another My Private Key';
484+
process.env['IMAGEKIT_PRIVATE_KEY'] = 'another My Private Key';
485485
process.env['OPTIONAL_IMAGEKIT_IGNORES_THIS'] = 'another My Password';
486486
const client = new ImageKit({ privateKey: 'My Private Key', password: 'My Password' });
487487
expect(client.privateKey).toBe('My Private Key');

0 commit comments

Comments
 (0)