(optionsSpotlight: boolean | string | undefined)
| 7 | * - `undefined`: defer entirely to the env var (bool or URL) |
| 8 | */ |
| 9 | export function getSpotlightConfig(optionsSpotlight: boolean | string | undefined): boolean | string | undefined { |
| 10 | if (optionsSpotlight === false) { |
| 11 | return false; |
| 12 | } |
| 13 | |
| 14 | if (typeof optionsSpotlight === 'string') { |
| 15 | return optionsSpotlight; |
| 16 | } |
| 17 | |
| 18 | // optionsSpotlight is true or undefined |
| 19 | const envBool = envToBool(process.env.SENTRY_SPOTLIGHT, { strict: true }); |
| 20 | const envUrl = envBool === null && process.env.SENTRY_SPOTLIGHT ? process.env.SENTRY_SPOTLIGHT : undefined; |
| 21 | |
| 22 | return optionsSpotlight === true |
| 23 | ? (envUrl ?? true) // true: use env URL if present, otherwise true |
| 24 | : (envBool ?? envUrl); // undefined: use env var (bool or URL) |
| 25 | } |
no test coverage detected