Skip to content

Commit ed25d2d

Browse files
vpellanmarcotc
andauthored
Update comment in lib/datadog/core/configuration/option.rb
Co-authored-by: Marco Costa <[email protected]>
1 parent 4d67ecc commit ed25d2d

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

lib/datadog/core/configuration/option.rb

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,9 @@ def unset(precedence)
121121

122122
def get
123123
unless @is_set
124-
# Previously, `set_value_from_env_or_default` was only setting env or default value, not both.
125-
# Which is problematic if we want to `unset` an env value, as it would not fallback on the default value.
126-
#
127-
# It also had inconsistent behavior. If an option didn't have an env,
128-
# it would call `set` with DEFAULT precedence and value, and set `@is_set` to true.
129-
# But if an option did have an env, it would set it with ENVIRONMENT precedence,
130-
# then by calling `unset` on the ENVIRONMENT value, it would `reset` the option,
131-
# set DEFAULT precedence and value, and change `@is_set` to false. because @is_set is false,
132-
# calling `get` would again call `set_value_from_env_or_default` and set the option back to the env value.
124+
# Ensures that both the default value and the environment value are set.
125+
# This approach handles scenarios where an environment value is unset
126+
# by falling back to the default value consistently.
133127
set_default_value
134128
set_env_value
135129
end

0 commit comments

Comments
 (0)