feat: enhance backend security and configuration
- Updated Dockerfile to improve security with a non-root user and added health checks. - Modified docker-compose.yml to set containers as read-only, restrict ports to localhost, and implement health checks. - Enhanced .env.example with additional environment variables for security and configuration. - Improved FastAPI application with middleware for security headers, CORS, and body size limits. - Refactored authentication flow in auth.py to include state validation and improved error handling. - Added rate limiting to various endpoints to prevent abuse. - Updated researcher and publication handling to ensure better validation and error management.
This commit is contained in:
@@ -9,9 +9,16 @@ import os
|
||||
# Cargar variables del .env
|
||||
load_dotenv()
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Variables de entorno
|
||||
# ---------------------------------------------------------
|
||||
|
||||
API_KEY = os.getenv("API_KEY_VALUE")
|
||||
BASE_URL = os.getenv("BASE_URL")
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Función auxiliar: ejecutar sincronización mensual
|
||||
# ---------------------------------------------------------
|
||||
|
||||
def run_monthly_sync():
|
||||
db = SessionLocal()
|
||||
@@ -36,6 +43,9 @@ def run_monthly_sync():
|
||||
|
||||
db.close()
|
||||
|
||||
# ---------------------------------------------------------
|
||||
# Función auxiliar: iniciar el scheduler
|
||||
# ---------------------------------------------------------
|
||||
|
||||
def start_scheduler():
|
||||
scheduler = BackgroundScheduler()
|
||||
|
||||
Reference in New Issue
Block a user