forked from Gozargah/Marzban
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
28 lines (26 loc) · 754 Bytes
/
main.py
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
import uvicorn
from app import app
from config import (
DEBUG,
UVICORN_HOST,
UVICORN_PORT,
UVICORN_UDS,
UVICORN_SSL_CERTFILE,
UVICORN_SSL_KEYFILE
)
if __name__ == "__main__":
# Do NOT change workers count for now
# multi-workers support isn't implemented yet for APScheduler and XRay module
try:
uvicorn.run(
"main:app",
host=('127.0.0.1' if DEBUG else UVICORN_HOST),
port=UVICORN_PORT,
uds=(None if DEBUG else UVICORN_UDS),
ssl_certfile=UVICORN_SSL_CERTFILE,
ssl_keyfile=UVICORN_SSL_KEYFILE,
workers=1,
reload=DEBUG
)
except FileNotFoundError: # to prevent error on removing unix sock
pass