-
-
Notifications
You must be signed in to change notification settings - Fork 494
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add support for $SENTRY_DEBUG and $SENTRY_SPOTLIGHT (#2374)
* feat: Add support for $SENTRY_DEBUG and $SENTRY_SPOTLIGHT Part of getsentry/spotlight#482. Similar to sentry-python#3443 but it also adds support for `$SENTRY_DEBUG` which was lacking in the Ruby SDK. * rubocop power! * add changelog entry * changelog with pr ref * try again * now? * maybe now? * fix typo * default to false rather than nil * use `self.` instead of module name Co-authored-by: Neel Shah <[email protected]> * add tests --------- Co-authored-by: Burak Yigit Kaya <[email protected]> Co-authored-by: Neel Shah <[email protected]>
- Loading branch information
1 parent
5c26b9e
commit 22f2a3a
Showing
4 changed files
with
108 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
module Sentry | ||
module Utils | ||
module EnvHelper | ||
TRUTHY_ENV_VALUES = %w[t true yes y 1 on].freeze | ||
FALSY_ENV_VALUES = %w[f false no n 0 off].freeze | ||
|
||
def self.env_to_bool(value, strict: false) | ||
value = value.to_s | ||
normalized = value.downcase | ||
|
||
return false if FALSY_ENV_VALUES.include?(normalized) | ||
|
||
return true if TRUTHY_ENV_VALUES.include?(normalized) | ||
|
||
strict ? nil : !(value.nil? || value.empty?) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters