Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use SENTRY_SPOTLIGHT as default value for Spotlight options #1789

Merged
merged 8 commits into from
Dec 10, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,10 @@ public function isSpotlightEnabled(): bool
return \is_string($this->options['spotlight']) || $this->options['spotlight'];
}

public function enableSpotlight(bool $enable): self
/**
* @param bool|string $enable can be passed a boolean or the Spotlight URL (which will also enable Spotlight)
*/
public function enableSpotlight($enable): self
{
$options = array_merge($this->options, ['spotlight' => $enable]);

Expand All @@ -389,6 +392,11 @@ public function getSpotlightUrl(): string
return $this->options['spotlight_url'];
}

/**
* @return $this
*
* @deprecated Use `enableSpotlight` instead. Will be removed in 5.x.
stayallive marked this conversation as resolved.
Show resolved Hide resolved
*/
public function setSpotlightUrl(string $url): self
{
$options = array_merge($this->options, ['spotlight_url' => $url]);
Expand Down Expand Up @@ -1132,6 +1140,9 @@ private function configureOptions(OptionsResolver $resolver): void
'environment' => $_SERVER['SENTRY_ENVIRONMENT'] ?? null,
'logger' => null,
'spotlight' => $_SERVER['SENTRY_SPOTLIGHT'] ?? null,
/**
* @deprecated Use `spotlight` instead. Will be removed in 5.x.
stayallive marked this conversation as resolved.
Show resolved Hide resolved
*/
'spotlight_url' => 'http://localhost:8969',
'release' => $_SERVER['SENTRY_RELEASE'] ?? $_SERVER['AWS_LAMBDA_FUNCTION_VERSION'] ?? null,
'dsn' => $_SERVER['SENTRY_DSN'] ?? null,
Expand Down Expand Up @@ -1269,7 +1280,7 @@ private function normalizeBooleanOrUrl(SymfonyOptions $options, ?string $boolean
return false;
}

if (str_starts_with($booleanOrUrl, 'http')) {
if (filter_var($booleanOrUrl, \FILTER_VALIDATE_URL)) {
return $booleanOrUrl;
}

Expand Down
Loading