Co-authored-by: Югай Артур Рустамович <f1ekserr@yandex.ru>
22 lines
629 B
Python
22 lines
629 B
Python
import logging
|
|
import os
|
|
|
|
import uvicorn
|
|
|
|
|
|
if __name__ == "__main__":
|
|
logging.basicConfig(level=logging.INFO, format="%(levelname)s %(message)s")
|
|
logging.getLogger("messenger").info("environment=%s", os.environ.get("APP_ENV", "lab"))
|
|
port = int(os.environ.get("APP_PORT", "8080"))
|
|
if not 1 <= port <= 65535:
|
|
raise SystemExit("APP_PORT должен быть от 1 до 65535")
|
|
uvicorn.run(
|
|
"src.app:create_app",
|
|
factory=True,
|
|
host=os.environ.get("APP_HOST", "0.0.0.0"),
|
|
port=port,
|
|
workers=1,
|
|
access_log=False,
|
|
timeout_graceful_shutdown=2,
|
|
)
|