-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathoptions.ts
More file actions
20 lines (17 loc) · 666 Bytes
/
options.ts
File metadata and controls
20 lines (17 loc) · 666 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import type { CloudflareOptions } from './client';
/**
* Merges the options passed in from the user with the options we read from
* the Cloudflare `env` environment variable object.
*
* @param userOptions - The options passed in from the user.
* @param env - The environment variables.
*
* @returns The final options.
*/
export function getFinalOptions(userOptions: CloudflareOptions, env: unknown): CloudflareOptions {
if (typeof env !== 'object' || env === null) {
return userOptions;
}
const release = 'SENTRY_RELEASE' in env && typeof env.SENTRY_RELEASE === 'string' ? env.SENTRY_RELEASE : undefined;
return { release, ...userOptions };
}