# config/settings.py import os from pathlib import Path from typing import Dict, Any def check_admin(password_input): admin_hash = st.secrets["admin"]["hash"] return bcrypt.checkpw(password_input.encode(), admin_hash.encode()) class Config: """Configuración principal de la aplicación""" # Directorios base BASE_DIR = Path(__file__).parent.parent EXPORTS_DIR = BASE_DIR / "exports" TEMPLATES_DIR = BASE_DIR / "templates" # Formatos soportados SUPPORTED_INPUT_FORMATS = ['.csv', '.json', '.xlsx', '.xls', '.txt'] SUPPORTED_OUTPUT_FORMATS = ['.csv', '.json', '.xlsx', '.txt', '.sql', '.db'] # Límites MAX_FILE_SIZE_MB = 500 MAX_ROWS_PREVIEW = 1000 # Configuración APIs API_FRAMEWORKS = ['fastapi', 'flask', 'django'] DATABASE_TYPES = ['sqlite', 'mysql', 'postgresql'] # Configuración por defecto DEFAULT_API_CONFIG = { 'framework': 'fastapi', 'authentication': True, 'pagination': True, 'documentation': True, 'cors': True } @classmethod def get_template_path(cls, template_type: str, template_name: str) -> Path: """Obtiene la ruta de una plantilla""" return cls.TEMPLATES_DIR / template_type / f"{template_name}.j2" @classmethod def get_export_path(cls, export_type: str, project_name: str) -> Path: """Obtiene la ruta de exportación""" export_dir = cls.EXPORTS_DIR / export_type / project_name export_dir.mkdir(parents=True, exist_ok=True) return export_dir # Instancia global de configuración config = Config()