Skip to content

Commit

Permalink
Refactor check_env_variable function in settings.py to handle empty e…
Browse files Browse the repository at this point in the history
…nvironment variables more effectively
  • Loading branch information
LimeDrive committed Sep 26, 2024
1 parent 585e6ed commit e63bbee
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions stream_fusion/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,9 @@ def get_default_worker_count():
return min(max(multiprocessing.cpu_count() * 2, 2), 6)

def check_env_variable(var_name):
"""Check if an environment variable is set and not empty."""
value = os.getenv(var_name.upper())
if value:
if value == '':
return False

if value and isinstance(value, str) and len(value.strip()) >= 10:
return True
return False

Expand Down

0 comments on commit e63bbee

Please sign in to comment.