File size: 572 Bytes
7b4b748
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/env python3
"""Run the ollive public OSS FastAPI server."""

from __future__ import annotations

import sys
from pathlib import Path

ROOT = Path(__file__).resolve().parents[1]
if str(ROOT) not in sys.path:
    sys.path.insert(0, str(ROOT))

import uvicorn

from api.settings import ApiConfig


def main() -> None:
    import os

    config = ApiConfig()
    port = int(os.getenv("PORT", str(config.port)))
    uvicorn.run(
        "api.main:app",
        host=config.host,
        port=port,
        reload=False,
    )


if __name__ == "__main__":
    main()