INNER CODE UNIT · Python
_positive_environment_integer
TianGzlab/OmicsClaw · omicsclaw/surfaces/desktop/server.py:383
def _positive_environment_integer(name: str, default: int) -> int:
raw = str(os.environ.get(name, "") or "").strip()
if not raw:
return default
if not raw.isdigit() or int(raw) <= 0:
raise RuntimeError(f"{name} must be a positive integer")
return int(raw)
def _app_cors_origins() -> list[str]:
raw = str(os.getenv("OMICSCLAW_APP_CORS_ORIGINS", "") or "").strip()
if not raw:
return list(_DEFAULT_APP_CORS_ORIGINS)
values = [item.strip() for item in raw.split(",") if item.strip()]
return values or list(_DEFAULT_APP_CORS_ORIGINS)
def _coerce_kg_home(candidate: str) -> Path: