Ë
    u´¦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mZmZ  e j"                  e«      Zed	efd
„«       Zdefd„ZdZy)é    N)Úasynccontextmanager)ÚFastAPI)ÚCORSMiddleware)ÚGZipMiddleware)Úsettings)Úroot_api_router)ÚHTTPExceptionÚhttp_exception_handlerÚGlobalExceptionMiddlewareÚappc                ój   K  — t         j                  d«       d­–— t         j                  d«       y­w)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/hotal-chatbot-be/app/__init__.pyÚlifespanr      s'   è ø€ ô ‡H�HÐ5Ô6ä	ô ‡K�KÐ9Õ:ùs   ‚13Úreturnc            	      ó²  — t         j                  d«       t        t        j                  t        j
                  dd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        ¬«      } | j                  t        «       | j                  t        d¬«       | j                  t        d	gd
g d¢d	g¬«       t         j                  d«       | j                  t         «       t         j                  d«       | j#                  t$        t&        «       | S )z)
    Initialize FastAPI application.
    z$Initialize FastAPI application node.Úurlzhttp://127.0.0.1:9000ÚdevelopmentN)ÚtitleÚdebugÚserversÚdocs_urlÚ	redoc_urlÚopenapi_urlr   iè  )Úminimum_sizeÚ*T)ÚGETÚPOSTÚPUTÚDELETEÚOPTIONSÚPATCH)Úallow_originsÚallow_credentialsÚallow_methodsÚallow_headerszAdd application routes.z;Register global exception handler for custom HTTPException.)r   r   r   r   ÚPROJECT_NAMEÚDEBUGÚENVÚDOCS_URLÚ	REDOC_URLÚOPENAPI_URLr   Úadd_middlewarer   r   r   Úinclude_routerr   Úadd_exception_handlerr	   r
   r   s    r   Úget_applicationr3   "   s
  € ô ‡I�IÐ4Ô5ä
Ü×#Ñ#Ü�n‰nØÐ0Ð1Ð2Ü&.§l¡l°mÒ&C”×"Ò"ÈÜ(0¯©¸Ò(E”(×$Ò$È4Ü,4¯L©L¸MÒ,I”H×(Ò(ÈtÜô€Cð ×ÑÔ0Ô1Ø×Ñ”~°DÐÔ9ð ×ÑÜØ�eØÚJØ�eð ô ô ‡I�IÐ'Ô(Ø×Ñ”Ô'ô ‡I�IÐKÔLØ×ÑœmÔ-CÔDà€Jó    )r3   )ÚloggingÚ
contextlibr   Úfastapir   Úfastapi.middleware.corsr   Úfastapi.middleware.gzipr   Ú
app.configr   Ú
app.routerr   Úapp.exceptionsr	   r
   r   Ú	getLoggerÚ__name__r   r   r3   Ú__all__© r4   r   Ú<module>rA      sg   ðÛ Ý *å Ý 2Ý 2å Ý &÷ñ ð €g×Ñ˜Ó!€ð ð;˜ò ;ó ð;ð%˜ó %ðN �r4   