import asyncio
import sys

import uvicorn

from api.api import API
from core.environment import Environment
from core.logger import Logger
from startup import Startup

logger = Logger(__name__)


def main():
    if sys.platform == "win32":
        from asyncio import WindowsSelectorEventLoopPolicy

        asyncio.set_event_loop_policy(WindowsSelectorEventLoopPolicy())

    Startup.configure()
    uvicorn.run(
        API.app,
        host="0.0.0.0",
        port=Environment.get("PORT", int, 5000),
        log_config=None,
    )


if __name__ == "__main__":
    main()

#           ((
#           ( )
#           ; / ,
#          /  \/
#         /  |
#        /  ~/
#       / )  )   ~ edraft
#   ___// | /
#   --'  \_~-,
