feat(base): finalizada Fase 1 scaffolding v0.1.0-alpha
This commit is contained in:
@@ -0,0 +1,66 @@
|
||||
# ==============================================================================
|
||||
# Configuración Tipada con Pydantic Settings
|
||||
# Compatible con Windows 10/11, LXC y Docker
|
||||
# ==============================================================================
|
||||
from pathlib import Path
|
||||
from typing import List, Union
|
||||
from pydantic import Field, field_validator
|
||||
from pydantic_settings import BaseSettings, SettingsConfigDict
|
||||
|
||||
|
||||
# Directorio raíz del proyecto (OnEverControl)
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent.parent.parent
|
||||
ENV_PATH = BASE_DIR / ".env"
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
model_config = SettingsConfigDict(
|
||||
env_file=str(ENV_PATH) if ENV_PATH.exists() else None,
|
||||
env_file_encoding="utf-8",
|
||||
extra="ignore",
|
||||
)
|
||||
|
||||
# Entorno
|
||||
ENVIRONMENT: str = "development"
|
||||
DEBUG: bool = True
|
||||
LOG_LEVEL: str = "INFO"
|
||||
|
||||
# Servidor
|
||||
SERVER_HOST: str = "0.0.0.0"
|
||||
SERVER_PORT: int = 8000
|
||||
ALLOWED_ORIGINS: Union[str, List[str]] = [
|
||||
"http://localhost:5173",
|
||||
"http://127.0.0.1:5173",
|
||||
"http://localhost:8000",
|
||||
"http://127.0.0.1:8000",
|
||||
]
|
||||
|
||||
# Base de Datos SQL Server (videoman)
|
||||
DB_SERVER: str = "127.0.0.1"
|
||||
DB_PORT: int = 1433
|
||||
DB_NAME: str = "videoman"
|
||||
DB_USER: str = "sa"
|
||||
DB_PASSWORD: str = ""
|
||||
DB_CHARSET: str = "CP1252"
|
||||
DB_TIMEOUT: int = 15
|
||||
|
||||
# Seguridad JWT
|
||||
SECRET_KEY: str = "dev_secret_key_change_in_production_min_32_chars_1234567890"
|
||||
ACCESS_TOKEN_EXPIRE_MINUTES: int = 30
|
||||
REFRESH_TOKEN_EXPIRE_DAYS: int = 7
|
||||
|
||||
# Estación por Defecto
|
||||
DEFAULT_WORKSTATION_NAME: str = "GARITA_PRINCIPAL"
|
||||
|
||||
@field_validator("ALLOWED_ORIGINS", mode="before")
|
||||
@classmethod
|
||||
def assemble_cors_origins(cls, v: Union[str, List[str]]) -> List[str]:
|
||||
if isinstance(v, str) and not v.startswith("["):
|
||||
return [i.strip() for i in v.split(",") if i.strip()]
|
||||
elif isinstance(v, list):
|
||||
return v
|
||||
return ["*"]
|
||||
|
||||
|
||||
# Instancia singleton de configuración
|
||||
settings = Settings()
|
||||
Reference in New Issue
Block a user