Skip to content
This repository was archived by the owner on Sep 22, 2024. It is now read-only.

Commit d9d5406

Browse files
committed
feat(api): adds (optional) envVarApiKey to NetzoOptions for admin/development/testing (internal)
1 parent 35820f8 commit d9d5406

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Diff for: mod.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ import {
2121
* @returns {Netzo} - a new instance of the Netzo SDK
2222
*/
2323
export const Netzo = (options: NetzoOptions) => {
24-
const { apiKey, baseURL = "https://api.netzo.io" } = options;
24+
const { apiKey, envVarApiKey, baseURL = "https://api.netzo.io" } = options;
2525

2626
const api = http({
2727
baseURL,
2828
headers: {
2929
"accept": "application/json",
3030
"content-type": "application/json",
31-
"x-api-key": apiKey,
31+
...(apiKey && { "x-api-key": apiKey }),
32+
...(envVarApiKey && { "x-env-var-api-key": envVarApiKey }),
3233
},
3334
});
3435

Diff for: types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export type Netzo = (options: NetzoOptions) => INetzo;
99

1010
export interface NetzoOptions {
1111
apiKey: string;
12+
envVarApiKey?: string; // for development/testing
1213
baseURL?: string;
1314
}
1415

0 commit comments

Comments
 (0)