maleo-foundation 0.1.25__py3-none-any.whl → 0.1.27__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- maleo_foundation/managers/service.py +31 -3
- {maleo_foundation-0.1.25.dist-info → maleo_foundation-0.1.27.dist-info}/METADATA +1 -1
- {maleo_foundation-0.1.25.dist-info → maleo_foundation-0.1.27.dist-info}/RECORD +5 -5
- {maleo_foundation-0.1.25.dist-info → maleo_foundation-0.1.27.dist-info}/WHEEL +0 -0
- {maleo_foundation-0.1.25.dist-info → maleo_foundation-0.1.27.dist-info}/top_level.txt +0 -0
@@ -365,17 +365,26 @@ class ServiceManager:
|
|
365
365
|
return result.data.token
|
366
366
|
|
367
367
|
def create_app(self, router:APIRouter, lifespan:Optional[Lifespan[AppType]] = None, request_processor:Optional[RequestProcessor] = None) -> FastAPI:
|
368
|
+
self._loggers.application.info("Creating FastAPI application")
|
368
369
|
self._app = FastAPI(title=self._configs.service.name, lifespan=lifespan)
|
370
|
+
self._loggers.application.info("FastAPI application created successfully")
|
369
371
|
|
372
|
+
#* Add middleware(s)
|
373
|
+
self._loggers.application.info("Configuring middlewares")
|
370
374
|
self._middleware = MiddlewareManager(app=self._app, configurations=self._configs.middleware)
|
371
375
|
self._middleware.add_all(loggers=self.loggers.middleware, key=self._keys.public, request_processor=request_processor)
|
376
|
+
self._loggers.application.info("Middlewares addedd successfully")
|
372
377
|
|
373
378
|
#* Add exception handler(s)
|
379
|
+
self._loggers.application.info("Adding exception handlers")
|
374
380
|
self._app.add_exception_handler(RequestValidationError, BaseExceptions.validation_exception_handler)
|
375
381
|
self._app.add_exception_handler(HTTPException, BaseExceptions.http_exception_handler)
|
382
|
+
self._loggers.application.info("Exception handlers addedd successfully")
|
376
383
|
|
377
384
|
#* Include router
|
385
|
+
self._loggers.application.info("Including routers")
|
378
386
|
self._app.include_router(router)
|
387
|
+
self._loggers.application.info("Routers included successfully")
|
379
388
|
|
380
389
|
return self._app
|
381
390
|
|
@@ -384,9 +393,16 @@ class ServiceManager:
|
|
384
393
|
return self._app
|
385
394
|
|
386
395
|
def run_app(self) -> None:
|
396
|
+
self._loggers.application.info("Detected environment: '%s'", self._settings.ENVIRONMENT)
|
387
397
|
if self._settings.ENVIRONMENT == BaseEnums.EnvironmentType.LOCAL:
|
388
398
|
import importlib.util
|
399
|
+
import logging
|
389
400
|
import sys
|
401
|
+
|
402
|
+
# Configure logging
|
403
|
+
logging.basicConfig(level=logging.DEBUG)
|
404
|
+
logger = logging.getLogger(__name__)
|
405
|
+
|
390
406
|
# Get the module path and add it to sys.path if needed
|
391
407
|
spec = importlib.util.find_spec("app")
|
392
408
|
if spec and spec.origin:
|
@@ -394,11 +410,23 @@ class ServiceManager:
|
|
394
410
|
if module_path not in sys.path:
|
395
411
|
sys.path.insert(0, module_path)
|
396
412
|
|
413
|
+
logger.debug(f"Module path: {module_path}")
|
397
414
|
# Create the import string for uvicorn
|
398
415
|
app_import_string = "app.main:app"
|
399
|
-
|
400
|
-
|
401
|
-
|
416
|
+
logger.debug(f"Using import string: {app_import_string}")
|
417
|
+
|
418
|
+
try:
|
419
|
+
uvicorn.run(
|
420
|
+
app_import_string,
|
421
|
+
host=self._configs.service.host,
|
422
|
+
port=self._configs.service.port,
|
423
|
+
reload=True,
|
424
|
+
log_level="debug",
|
425
|
+
reload_dirs=[os.path.dirname(os.path.dirname(spec.origin))]
|
426
|
+
)
|
427
|
+
except Exception as e:
|
428
|
+
logger.error(f"Error starting uvicorn: {e}")
|
429
|
+
raise
|
402
430
|
else:
|
403
431
|
uvicorn.run(self._app, host=self._configs.service.host, port=self._configs.service.port)
|
404
432
|
|
@@ -32,7 +32,7 @@ maleo_foundation/expanded_types/token.py,sha256=4fRTJw6W5MYq71NksNrWNi7qYHQ4_lQw
|
|
32
32
|
maleo_foundation/managers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
33
33
|
maleo_foundation/managers/db.py,sha256=Jf0w-9JOAG5X2quDxqqw6d2WUIX7MYGdlPGxWP0rxHs,4699
|
34
34
|
maleo_foundation/managers/middleware.py,sha256=7CDXPMb28AR7J72TWOeKFxOlMypKezEtO9mr53a88B0,4032
|
35
|
-
maleo_foundation/managers/service.py,sha256=
|
35
|
+
maleo_foundation/managers/service.py,sha256=dNf39FZ8-n51IF7M7LIhMDfKz1ydGWo7f3gmwpg-rso,21397
|
36
36
|
maleo_foundation/managers/client/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
37
37
|
maleo_foundation/managers/client/base.py,sha256=K8AFV2MTZrC1jbTqxkx7eedmxodJirNIjoRXGGcppy4,1022
|
38
38
|
maleo_foundation/managers/client/http.py,sha256=dWFZlG1z4TERYBITReR5oSrlzvdhh2EtztVnsU8gCeA,2712
|
@@ -83,7 +83,7 @@ maleo_foundation/utils/logging.py,sha256=MwvZmZSA8SIdfq-knEvpYIgqnSpHcyHrZY9TVHW
|
|
83
83
|
maleo_foundation/utils/query.py,sha256=ODQ3adOYQNj5E2cRW9ytbjBz56nEDcnfq8mQ6YZbCCM,4375
|
84
84
|
maleo_foundation/utils/formatter/__init__.py,sha256=iKf5YCbEdg1qKnFHyKqqcQbqAqEeRUf8mhI3v3dQoj8,78
|
85
85
|
maleo_foundation/utils/formatter/case.py,sha256=TmvvlfzGdC_omMTB5vAa40TZBxQ3hnr-SYeo0M52Rlg,1352
|
86
|
-
maleo_foundation-0.1.
|
87
|
-
maleo_foundation-0.1.
|
88
|
-
maleo_foundation-0.1.
|
89
|
-
maleo_foundation-0.1.
|
86
|
+
maleo_foundation-0.1.27.dist-info/METADATA,sha256=9p7STmqyZowiuayTYRsEhrdhOxwgZv8s4EXbQlD7RFY,3190
|
87
|
+
maleo_foundation-0.1.27.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
88
|
+
maleo_foundation-0.1.27.dist-info/top_level.txt,sha256=_iBos3F_bhEOdjOnzeiEYSrCucasc810xXtLBXI8cQc,17
|
89
|
+
maleo_foundation-0.1.27.dist-info/RECORD,,
|
File without changes
|
File without changes
|