Skip to content

Commit

Permalink
fix: edge case env var with None value
Browse files Browse the repository at this point in the history
  • Loading branch information
sagivoululumigo committed Sep 10, 2023
1 parent be82dde commit 7b96321
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/lumigo_opentelemetry/libs/general_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ def get_boolean_env_var(env_var_name: str, default: bool = False) -> bool:
@return: The boolean value of the env var
"""

env_var_value = os.environ.get(env_var_name, str(default)).lower()
env_var_value = os.environ.get(env_var_name, str(default))
env_var_value = env_var_value.lower() if isinstance(env_var_value, str) else env_var_value

is_truth_value = env_var_value == "true"
is_false_value = env_var_value == "false"
if not is_truth_value and not is_false_value:
Expand Down

0 comments on commit 7b96321

Please sign in to comment.