mirror of
https://github.com/clearml/clearml-server
synced 2025-01-31 19:06:55 +00:00
02933a9c93
Return fixed server header
15 lines
396 B
Python
15 lines
396 B
Python
from distutils.util import strtobool
|
|
from os import getenv
|
|
from typing import Optional
|
|
|
|
|
|
def get_bool(*keys: str, default: bool = None) -> Optional[bool]:
|
|
try:
|
|
value = next(env for env in (getenv(key) for key in keys) if env is not None)
|
|
except StopIteration:
|
|
return default
|
|
try:
|
|
return bool(strtobool(value))
|
|
except ValueError:
|
|
return bool(value)
|