Rifqi Hafizuddin
/fix default SKIP_INIT_DB=true for dedorch cutover (skip init_db on Go-owned schema)
781b93c | """Centralized configuration management using pydantic-settings.""" | |
| # import os | |
| # from typing import Optional | |
| from pydantic import Field | |
| from pydantic_settings import BaseSettings, SettingsConfigDict | |
| class Settings(BaseSettings): | |
| """Application settings loaded from environment variables.""" | |
| model_config = SettingsConfigDict( | |
| env_file=".env", | |
| env_file_encoding="utf-8", | |
| extra="allow", | |
| case_sensitive=False, | |
| ) | |
| # Feature flags | |
| # Route `structured` chat intents through the analytical SLOW PATH | |
| # (Planner -> TaskRunner -> Assembler) instead of the single-query QueryService. | |
| # Off by default; the team flips ENABLE_SLOW_PATH=true to test end-to-end from | |
| # the /chat/stream endpoint. BusinessContext is still a stub until the lead's | |
| # real source lands, so this stays opt-in. | |
| enable_slow_path: bool = Field(alias="enable_slow_path", default=False) | |
| # DEPRECATED 2026-06-24: the problem_validated gate was removed (the goal is now | |
| # user-entered objective + business_questions, no agent validation). This flag no | |
| # longer has any effect — the gate call site in ChatHandler is commented out. Kept | |
| # to avoid .env churn; remove once no environment references it. | |
| enable_gate: bool = Field(alias="enable_gate", default=False) | |
| # Skip init_db() (create_all + startup DDL) on boot. TRUE by default post-dedorch | |
| # cutover: Go owns the dedorch schema, so Python (consumer-only role) must NOT run | |
| # init_db — its ALTER/index DDL on Go-owned tables fails with InsufficientPrivilege | |
| # ("must be owner of table rooms"). Set to false only for a local Python-owned DB. | |
| skip_init_db: bool = Field(alias="SKIP_INIT_DB", default=True) | |
| # Database | |
| postgres_connstring: str | |
| # Redis | |
| redis_url: str | |
| redis_prefix: str = "dataeyond-agent-service_" | |
| # Azure OpenAI - GPT-4o (map to .env names with double underscores) | |
| azureai_api_key_4o: str = Field(alias="azureai__api_key__4o", default="") | |
| azureai_endpoint_url_4o: str = Field(alias="azureai__endpoint__url__4o", default="") | |
| azureai_deployment_name_4o: str = Field(alias="azureai__deployment__name__4o", default="") | |
| azureai_api_version_4o: str = Field(alias="azureai__api__version__4o", default="") | |
| # Azure OpenAI - Embeddings | |
| azureai_api_key_embedding: str = Field(alias="azureai__api_key__embedding", default="") | |
| azureai_endpoint_url_embedding: str = Field(alias="azureai__endpoint__url__embedding", default="") | |
| azureai_deployment_name_embedding: str = Field(alias="azureai__deployment__name__embedding", default="") | |
| azureai_api_version_embedding: str = Field(alias="azureai__api__version__embedding", default="") | |
| # Azure Document Intelligence | |
| azureai_docintel_endpoint: str = Field(alias="azureai__docintel__endpoint", default="") | |
| azureai_docintel_key: str = Field(alias="azureai__docintel__key", default="") | |
| # Azure Blob Storage | |
| azureai_blob_sas: str = Field(alias="azureai__blob__sas", default="") | |
| azureai_container_endpoint: str = Field(alias="azureai__container__endpoint", default="") | |
| azureai_container_name: str = Field(alias="azureai__container__name", default="") | |
| azureai_container_account_name: str = Field(alias="azureai__container__account__name", default="") | |
| # Langfuse | |
| LANGFUSE_PUBLIC_KEY: str | |
| LANGFUSE_SECRET_KEY: str | |
| LANGFUSE_HOST: str | |
| # MongoDB (for users - existing) | |
| # emarcal_mongo_endpoint_url: str = Field(alias="emarcal__mongo__endpoint__url", default="") | |
| # emarcal_buma_mongo_dbname: str = Field(alias="emarcal__buma__mongo__dbname", default="") | |
| # JWT (for users - existing) | |
| emarcal_jwt_secret_key: str = Field(alias="emarcal__jwt__secret_key", default="") | |
| emarcal_jwt_algorithm: str = Field(alias="emarcal__jwt__algorithm", default="HS256") | |
| # Bcrypt salt (for users - existing) | |
| emarcal_bcrypt_salt: str = Field(alias="emarcal__bcrypt__salt", default="") | |
| # DB credential encryption (Fernet key for user-registered database creds) | |
| dataeyond_db_credential_key: str = Field( | |
| alias="dataeyond__db__credential__key" | |
| ) | |
| # Singleton instance | |
| settings = Settings() | |