
    i	                         d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ d d	lmZmZmZ  e j        e          Zed
efd            ZdefdZdZdS )    N)asynccontextmanager)FastAPI)CORSMiddleware)GZipMiddleware)settings)AuthenticationMiddleware)root_api_router)HTTPExceptionhttp_exception_handlerGlobalExceptionMiddlewareappc                |   K   t                               d           dW V  t                               d           dS )z~
    Define FastAPI lifespan events (startup and shutdown).
    Handles database connection pool and other cleanup tasks.
    z&Execute FastAPI startup event handler.Nz'Execute FastAPI shutdown event handler.)loginfowarningr   s    -/var/www/html/ls-ibe-bot-apis/app/__init__.pylifespanr      sC       HH5666 
EEEE
 KK9:::::    returnc            	      V   t                               d           t          t          j        t          j        ddt          j         igt          j        dk    rt          j        ndt          j        dk    rt          j	        ndt          j        dk    rt          j
        ndt                    } |                     t                     |                     t          d           t                               d	           |                     t                      t                               d
           |                     t$          t&                     t                               d           |                     t(                     |                     t*          dgdg ddg           | S )z)
    Initialize FastAPI application.
    z$Initialize FastAPI application node.urlzhttp://127.0.0.1:developmentN)titledebugserversdocs_url	redoc_urlopenapi_urlr   i  )minimum_sizezAdd application routes.z;Register global exception handler for custom HTTPException.zAdd authentication middleware.*T)GETPOSTPUTDELETEOPTIONSPATCH)allow_originsallow_credentialsallow_methodsallow_headers)r   r   r   r   PROJECT_NAMEDEBUG
HOTEL_PORTENVDOCS_URL	REDOC_URLOPENAPI_URLr   add_middlewarer   r   include_routerr	   add_exception_handlerr
   r   r   r   r   s    r   get_applicationr6   +   s    II4555
#nBX-@BBCD&.lm&C&C""(0(E(E($$4,4LM,I,IH((t  C 0111~D999 II'(((''' IIKLLLm-CDDD II.////000eJJJe	     Jr   )r6   )logging
contextlibr   fastapir   fastapi.middleware.corsr   fastapi.middleware.gzipr   app.configsr   app.middleware.authenticationr   app.routersr	   app.exceptionsr
   r   r   	getLogger__name__r   r   r6   __all__ r   r   <module>rD      s!    * * * * * *       2 2 2 2 2 2 2 2 2 2 2 2             B B B B B B ' ' ' ' ' '          g!! ; ; ; ; ;(' ' ' ' 'R r   