You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @param {string} [opts.baseURL=process.env['KERNEL_BASE_URL'] ?? http://localhost:3001] - Override the default base URL for the API.
147
+
* @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
148
+
* @param {string} [opts.baseURL=process.env['KERNEL_BASE_URL'] ?? https://api.onkernel.com/] - Override the default base URL for the API.
133
149
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
134
150
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
135
151
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
@@ -151,10 +167,17 @@ export class Kernel {
151
167
constoptions: ClientOptions={
152
168
apiKey,
153
169
...opts,
154
-
baseURL: baseURL||`http://localhost:3001`,
170
+
baseURL,
171
+
environment: opts.environment??'production',
155
172
};
156
173
157
-
this.baseURL=options.baseURL!;
174
+
if(baseURL&&opts.environment){
175
+
thrownewErrors.KernelError(
176
+
'Ambiguous URL; The `baseURL` option (or KERNEL_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null',
()=>newKernel({apiKey: 'My API Key',environment: 'production'}),
319
+
).toThrowErrorMatchingInlineSnapshot(
320
+
`"Ambiguous URL; The \`baseURL\` option (or KERNEL_BASE_URL env var) and the \`environment\` option are given. If you want to use the environment you must pass baseURL: null"`,
321
+
);
322
+
323
+
constclient=newKernel({apiKey: 'My API Key',baseURL: null,environment: 'production'});
0 commit comments