mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-05 10:58:34 +08:00
19 lines
397 B
Python
19 lines
397 B
Python
|
|
import os
|
||
|
|
|
||
|
|
|
||
|
|
def env_bool(name: str, default: bool = False) -> bool:
|
||
|
|
value = os.getenv(name)
|
||
|
|
if not value:
|
||
|
|
return default
|
||
|
|
return value.strip().lower() in {"1", "true", "yes", "on"}
|
||
|
|
|
||
|
|
|
||
|
|
def env_int(name: str, default: int) -> int:
|
||
|
|
value = os.getenv(name)
|
||
|
|
if not value:
|
||
|
|
return default
|
||
|
|
try:
|
||
|
|
return int(value)
|
||
|
|
except ValueError:
|
||
|
|
return default
|