mirror of https://github.com/papermerge/mglib
17 lines
378 B
Python
17 lines
378 B
Python
import os
|
|
|
|
|
|
def get_bool(key, default="NO"):
|
|
"""
|
|
Returns True if environment variable named KEY is one of
|
|
"yes", "y", "t", "true" (lowercase of uppercase)
|
|
|
|
otherwise returns False
|
|
"""
|
|
env_var_value = os.getenv(key, default).lower()
|
|
YES_VALUES = ("yes", "y", "1", "t", "true")
|
|
if env_var_value in YES_VALUES:
|
|
return True
|
|
|
|
return False
|