File size: 1,433 Bytes
bacd765
 
 
 
 
 
 
2f5219d
 
 
bacd765
2f5219d
bacd765
 
 
 
 
 
 
 
 
2f5219d
 
 
 
 
 
 
 
bacd765
 
 
 
 
 
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
# 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()