Skip to content

Commit

Permalink
Merge branch 'release-0.2.0' into feat/prashanth-email-trigger-1226
Browse files Browse the repository at this point in the history
  • Loading branch information
prv-proton authored Dec 10, 2024
2 parents 875937c + e3b3a67 commit d7124ab
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
3 changes: 2 additions & 1 deletion backend/lcfs/web/api/monitoring/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@


@router.get("/health")
def health_check() -> None:
def health_check() -> str:
"""
Checks the health of a project.
It returns 200 if the project is healthy.
"""
return "healthy"
19 changes: 9 additions & 10 deletions backend/lcfs/web/application.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
from importlib import metadata
import structlog
import logging
import uuid

import os
import debugpy
import structlog
from fastapi import FastAPI, HTTPException
from fastapi.exceptions import RequestValidationError
from fastapi.responses import UJSONResponse
from fastapi.middleware.cors import CORSMiddleware
from fastapi.responses import UJSONResponse
from prometheus_fastapi_instrumentator import Instrumentator
from starlette.middleware.authentication import AuthenticationMiddleware
from starlette.authentication import (
AuthenticationBackend,
AuthCredentials,
UnauthenticatedUser,
)
from starlette.middleware.authentication import AuthenticationMiddleware
from starlette.middleware.base import BaseHTTPMiddleware
from starlette.requests import Request
from starlette.responses import JSONResponse
import uuid
import contextvars

from lcfs.settings import settings
from lcfs.logging_config import setup_logging, correlation_id_var
from lcfs.web.api.router import api_router
from lcfs.services.keycloak.authentication import UserAuthentication
from lcfs.settings import settings
from lcfs.web.api.router import api_router
from lcfs.web.exception.exception_handler import validation_exception_handler
from lcfs.web.lifetime import register_shutdown_event, register_startup_event

Expand Down Expand Up @@ -67,6 +63,9 @@ async def authenticate(self, request):
if request.scope["method"] == "OPTIONS":
return AuthCredentials([]), UnauthenticatedUser()

if request.url.path == "/api/health": # Skip for health check
return AuthCredentials([]), UnauthenticatedUser()

# Lazily retrieve Redis, session, and settings from app state
redis_client = self.app.state.redis_client
session_factory = self.app.state.db_session_factory
Expand Down

0 comments on commit d7124ab

Please sign in to comment.