INNER CODE UNIT · Python
_validate_server_security
TianGzlab/OmicsClaw · omicsclaw/memory/server.py:46
def _validate_server_security(host: str, api_token: str) -> None:
if _is_local_bind_host(host):
return
if str(api_token or "").strip():
return
raise SystemExit(
"Refusing to expose the memory API on a non-local interface without "
"OMICSCLAW_MEMORY_API_TOKEN. Bind to 127.0.0.1/localhost or set a bearer token."
)
def _build_app():
"""Build and configure the FastAPI application."""
if not _HAS_FASTAPI:
return None
@asynccontextmanager
async def lifespan(app):