Fixes read_config_bool to allow several true params

This commit is contained in:
Joao Ramos 2022-09-07 15:01:07 +02:00
parent 32ad39d0e1
commit f968667bc1

View File

@ -16,9 +16,10 @@ def gen_file_hash(path: str, static_file: str) -> str:
def read_config_bool(var: str) -> bool: def read_config_bool(var: str) -> bool:
val = os.getenv(var, '0') val = os.getenv(var, '0')
if val.isdigit(): # user can specify one of the following values as 'true' inputs:
return bool(int(val)) # ('true', 't', '1', 'yes', 'y')
return False val = val.lower() in ('true', 't', '1', 'yes', 'y')
return val
def get_client_ip(r: Request) -> str: def get_client_ip(r: Request) -> str: