You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
orquestrador/app/core/settings.py

87 lines
2.7 KiB
Python

from pydantic import field_validator
from pydantic_settings import BaseSettings, SettingsConfigDict
class Settings(BaseSettings):
model_config = SettingsConfigDict(
env_file=".env",
extra="ignore",
)
google_project_id: str
google_location: str = "us-central1"
vertex_model_name: str = "gemini-2.5-pro"
# Tools database (MySQL)
db_host: str = "127.0.0.1"
db_port: int = 3306
db_user: str = "root"
db_password: str = ""
db_name: str = "orquestrador_mock"
db_cloud_sql_connection_name: str | None = None
# Mock database (MySQL) for fictitious business data
mock_db_host: str = "127.0.0.1"
mock_db_port: int = 3306
mock_db_user: str = "root"
mock_db_password: str = ""
mock_db_name: str = "orquestrador_mock"
mock_db_cloud_sql_connection_name: str | None = None
mock_seed_enabled: bool = True
auto_seed_tools: bool = True
auto_seed_mock: bool = True
environment: str = "production"
debug: bool = False
# Cloud SQL (legacy Postgres var kept only for backward compatibility in deploy scripts)
cloud_sql_connection_name: str | None = None
# Parametros de rede legados (mantidos por compatibilidade)
run_vpc_connector: str | None = None
run_vpc_egress: str = "private-ranges-only"
# Telegram satellite
telegram_bot_token: str | None = None
telegram_polling_timeout: int = 30
telegram_request_timeout: int = 45
# Conversation state backend
conversation_state_backend: str = "memory"
conversation_state_ttl_minutes: int = 60
# Redis conversation state
redis_url: str = "redis://127.0.0.1:6379/0"
redis_key_prefix: str = "orquestrador"
redis_socket_timeout_seconds: int = 5
# External integrations
integrations_enabled: bool = False
integration_sync_delivery_enabled: bool = True
brevo_api_key: str | None = None
brevo_base_url: str = "https://api.brevo.com/v3"
brevo_sender_email: str | None = None
brevo_sender_name: str = "Orquestrador"
brevo_request_timeout_seconds: int = 10
@field_validator("debug", mode="before")
@classmethod
def parse_debug_aliases(cls, value):
if isinstance(value, str):
normalized = value.strip().lower()
if normalized in {"debug", "development", "dev"}:
return True
if normalized in {"release", "production", "prod"}:
return False
return value
@field_validator("environment", "conversation_state_backend", mode="before")
@classmethod
def normalize_text_settings(cls, value):
if isinstance(value, str):
return value.strip().lower()
return value
settings = Settings()