File size: 1,638 Bytes
68e9069
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 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()