35 lines
801 B
Python
35 lines
801 B
Python
"""Entry point for the brain_api FastAPI service.
|
|
|
|
python -m brain_api.run
|
|
|
|
Bind host defaults to 127.0.0.1 (local dev, loopback only). Containerized
|
|
runs must override with BRAIN_API_HOST=0.0.0.0 so Docker port mapping can
|
|
actually forward traffic in from the outside.
|
|
|
|
Environment variables:
|
|
BRAIN_API_HOST bind address (default: 127.0.0.1)
|
|
BRAIN_API_PORT port (default: 8090)
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import os
|
|
|
|
import uvicorn
|
|
|
|
|
|
def main() -> None:
|
|
host = os.environ.get("BRAIN_API_HOST", "127.0.0.1")
|
|
port = int(os.environ.get("BRAIN_API_PORT", "8090"))
|
|
uvicorn.run(
|
|
"brain_api.app:app",
|
|
host=host,
|
|
port=port,
|
|
reload=False,
|
|
log_level="info",
|
|
access_log=True,
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|