File size: 765 Bytes
db3bb4f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
Server entry point for CodeReview OpenEnv.

This module provides the main() entry point used by:
  - pyproject.toml [project.scripts] server = "server.app:main"
  - openenv serve
  - uv run server

It imports and runs the FastAPI app defined in the root app.py.
"""

from __future__ import annotations

import sys
import os

# Ensure project root is importable
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))


def main(host: str = "0.0.0.0", port: int = 7860, workers: int = 1) -> None:
    """Start the CodeReview OpenEnv server."""
    import uvicorn

    uvicorn.run(
        "app:app",
        host=host,
        port=int(os.environ.get("PORT", port)),
        workers=workers,
    )


if __name__ == "__main__":
    main()