mongo updated

This commit is contained in:
2025-01-10 20:52:45 +03:00
parent d8685dd496
commit cecf1e69a2
66 changed files with 3597 additions and 857 deletions

View File

@@ -2,35 +2,35 @@ FROM python:3.12-slim-bookworm
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH=/service_app
COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /bin/
WORKDIR /service_app
# Create logs directory
RUN mkdir -p /service_app/logs
COPY ApiServices/ValidationService/pyproject.toml .
RUN uv venv
RUN uv pip install -r pyproject.toml
RUN uv venv .venv
RUN . .venv/bin/activate && uv pip install -r pyproject.toml
COPY ApiServices/ValidationService ./service_app
COPY ApiServices/api_handlers ./service_app/api_handlers
COPY ApiServices ./ApiServices
COPY databases ./databases
COPY api_services ./api_services
COPY api_objects ./api_objects
COPY api_configs ./api_configs
COPY api_events ./api_events
COPY api_library ./api_library
COPY api_validations ./api_validations
COPY databases ./service_app/databases
COPY api_services ./service_app/api_services
COPY api_objects ./service_app/api_objects
COPY api_configs ./service_app/api_configs
COPY api_events ./service_app/api_events
COPY api_library ./service_app/api_library
COPY api_validations ./service_app/api_validations
WORKDIR /service_app/ApiServices/ValidationService
WORKDIR /service_app
# Create startup script
RUN echo '#!/bin/bash\n\
source /service_app/.venv/bin/activate\n\
exec python app.py' > /service_app/start.sh && \
chmod +x /service_app/start.sh
CMD ["uv", "run", "app.py"]
# Old File
#FROM python:3.10
#RUN pip install --upgrade pip
#RUN pip install --no-cache-dir --upgrade -r requirements.txt
#CMD ["python", "-m", "app"]
CMD ["/service_app/start.sh"]

View File

@@ -2,7 +2,8 @@ import uvicorn
import routers
from fastapi.middleware.cors import CORSMiddleware
from fastapi.exceptions import HTTPException
from fastapi import Request, HTTPException, status
from fastapi.responses import JSONResponse
from middlewares.token_middleware import AuthHeaderMiddleware
from application.create_file import create_app
@@ -23,8 +24,17 @@ app.add_middleware(
)
app.add_middleware(AuthHeaderMiddleware)
app.add_exception_handler(HTTPException, ErrorHandlers.exception_handler_http)
app.add_exception_handler(Exception, ErrorHandlers.exception_handler_exception)
# Initialize error handlers
error_handlers = ErrorHandlers.create(
requests=Request,
exceptions=HTTPException,
response_model=JSONResponse,
status=status,
)
# Register error handlers with bound methods
app.add_exception_handler(HTTPException, error_handlers.exception_handler_http)
app.add_exception_handler(Exception, error_handlers.exception_handler_exception)
if __name__ == "__main__":
uvicorn_config = {

View File

@@ -72,9 +72,9 @@ def check_if_path_secure(request, insecure_paths) -> bool:
def check_if_token_is_not_valid(request, endpoint_name):
from api_services.redis.functions import get_object_via_access_key
from api_services.redis.functions import RedisActions
token_user = get_object_via_access_key(request)
token_user = RedisActions.get_object_via_access_key(request)
if not token_user:
return "Session geçerli değil. Lütfen tekrar giriş yapınız.", token_user

View File

@@ -1,5 +1,5 @@
[project]
name = "wag-managment-api-service-version-3"
name = "wag-managment-api-service-version-3-validation-service"
version = "0.1.0"
description = "Wag Python API Service"
readme = "README.md"