forked from Gozargah/Marzban
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
29 lines (28 loc) · 830 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
29
import uvicorn
from app import app
from config import (
DEBUG,
UVICORN_HOST,
UVICORN_PORT,
UVICORN_UDS,
UVICORN_SSL_CERTFILE,
UVICORN_SSL_KEYFILE
)
import logging
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=('0.0.0.0' 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,
log_level=logging.DEBUG if DEBUG else logging.INFO
)
except FileNotFoundError: # to prevent error on removing unix sock
pass