CognitiveEDA / core /config.py
mgbam's picture
Update core/config.py
2f5219d verified
# core/config.py
# -*- coding: utf-8 -*-
#
# PROJECT: CognitiveEDA v5.0 - The QuantumLeap Intelligence Platform
#
# DESCRIPTION: Centralized, environment-aware configuration management using
# Pydantic for robust validation and type safety. This version is
# updated to allow the application to start even if the optional
# API key is missing.
from typing import Optional
from pydantic_settings import BaseSettings, SettingsConfigDict
class AppConfig(BaseSettings):
"""
Application configuration model. Loads settings from a .env file.
"""
APP_TITLE: str = "πŸš€ CognitiveEDA v5.0: The QuantumLeap Intelligence Platform"
GEMINI_MODEL: str = 'gemini-1.5-flash-latest'
MAX_UI_ROWS: int = 50_000
# --- ARCHITECTURAL IMPROVEMENT ---
# The GOOGLE_API_KEY is now optional. By setting the type to Optional[str]
# and the default to None, Pydantic will no longer raise a validation
# error if the key is not found in the environment. This allows the
# application to start successfully. The check for its existence will
# be performed at runtime in the callback logic.
GOOGLE_API_KEY: Optional[str] = None
# Pydantic settings configuration
model_config = SettingsConfigDict(env_file='.env', env_file_encoding='utf-8', extra='ignore')
# Instantiate the configuration object to be imported by other modules
settings = AppConfig()