Spaces:
Running
Running
Commit ·
c1dcf53
1
Parent(s): 902a33d
Add server.py to tracked files
Browse files
server.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Claude Code Proxy - Entry Point
|
| 3 |
+
|
| 4 |
+
Minimal entry point that builds the ASGI app via :func:`api.app.create_app`.
|
| 5 |
+
Run with: uv run uvicorn server:app --host 0.0.0.0 --port 8082 --timeout-graceful-shutdown 5
|
| 6 |
+
"""
|
| 7 |
+
|
| 8 |
+
from api.app import create_app, create_asgi_app
|
| 9 |
+
|
| 10 |
+
app = create_asgi_app()
|
| 11 |
+
|
| 12 |
+
__all__ = ["app", "create_app"]
|
| 13 |
+
|
| 14 |
+
if __name__ == "__main__":
|
| 15 |
+
import uvicorn
|
| 16 |
+
|
| 17 |
+
from cli.process_registry import kill_all_best_effort
|
| 18 |
+
from config.settings import get_settings
|
| 19 |
+
|
| 20 |
+
settings = get_settings()
|
| 21 |
+
try:
|
| 22 |
+
# timeout_graceful_shutdown ensures uvicorn doesn't hang on task cleanup.
|
| 23 |
+
uvicorn.run(
|
| 24 |
+
app,
|
| 25 |
+
host=settings.host,
|
| 26 |
+
port=settings.port,
|
| 27 |
+
log_level="debug",
|
| 28 |
+
timeout_graceful_shutdown=5,
|
| 29 |
+
)
|
| 30 |
+
finally:
|
| 31 |
+
# Safety net: cleanup subprocesses if lifespan shutdown doesn't fully run.
|
| 32 |
+
kill_all_best_effort()
|