Allow different `true` values for config vars (#841)

* Fixes read_config_bool to allow several true params

* add upper case comment
このコミットが含まれているのは:
João 2022-09-07 20:54:43 +02:00 committed by GitHub
コミット 8f59b7c340
この署名に対応する既知のキーがデータベースに存在しません
GPGキーID: 4AEE18F83AFDEB23
1個のファイルの変更5行の追加3行の削除

ファイルの表示

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