File size: 1,342 Bytes
f3997d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34c2ec3
f3997d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from pydantic_settings import BaseSettings
from typing import List, Optional


class Settings(BaseSettings):
    """Application settings loaded from environment variables."""
    
    # App Configuration
    SECRET_KEY: str
    DEBUG: bool = False
    PORT: int = 8000
    
    # Database
    DATABASE_URL: str = "sqlite:///data/database.db"
    
    # AI Services
    GROQ_API_KEY: str
    GROQ_MODEL: str = "llama-3.1-8b-instant"
    TAVILY_API_KEY: str
    
    # JWT Configuration
    ACCESS_TOKEN_EXPIRE_MINUTES: int = 15
    REFRESH_TOKEN_EXPIRE_DAYS: int = 7
    ALGORITHM: str = "HS256"
    
    # Google OAuth
    GOOGLE_CLIENT_ID: Optional[str] = ""
    GOOGLE_CLIENT_SECRET: Optional[str] = ""
    GOOGLE_REDIRECT_URI: Optional[str] = ""
    
    # CORS
    ALLOWED_ORIGINS: str = "*"
    
    @property
    def cors_origins(self) -> List[str]:
        """Parse CORS origins from comma-separated string."""
        return [origin.strip() for origin in self.ALLOWED_ORIGINS.split(",")]
    
    # Backward compatibility properties (lowercase)
    @property
    def secret_key(self) -> str:
        return self.SECRET_KEY
    
    @property
    def algorithm(self) -> str:
        return self.ALGORITHM
    
    class Config:
        env_file = ".env"
        case_sensitive = True


# Global settings instance
settings = Settings()