Module: Datadog::Core::Environment::VariableHelpers
- Extended by:
- VariableHelpers
- Included in:
- VariableHelpers
- Defined in:
- lib/datadog/core/environment/variable_helpers.rb
Overview
Defines helper methods for environment
Instance Method Summary collapse
-
#env_to_bool(var, default = nil, deprecation_warning: true) ⇒ Boolean, default
Reads an environment variable as a Boolean.
Instance Method Details
#env_to_bool(var, default = nil, deprecation_warning: true) ⇒ Boolean, default
Reads an environment variable as a Boolean.
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/datadog/core/environment/variable_helpers.rb', line 21 def env_to_bool(var, default = nil, deprecation_warning: true) var = decode_array(var, deprecation_warning) if var && ENV.key?(var) value = ENV[var].to_s.strip value.downcase! value == 'true' || value == '1' # rubocop:disable Style/MultipleComparison else default end end |