-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.py
More file actions
66 lines (47 loc) · 2.08 KB
/
Copy pathconfig.py
File metadata and controls
66 lines (47 loc) · 2.08 KB
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
56
57
58
59
60
61
62
63
64
65
66
"""Application configuration management.
This module handles all application settings loaded from environment variables.
Settings are cached for performance using LRU cache.
"""
from pydantic_settings import BaseSettings
from functools import lru_cache
class Settings(BaseSettings):
"""Application settings loaded from environment variables.
All settings can be overridden via .env file or environment variables.
"""
# MongoDB Configuration
mongodb_url: str # MongoDB connection string (required)
database_name: str = "cortex" # Database name (default: cortex)
# JWT Authentication Configuration
secret_key: str # Secret key for JWT signing (required)
algorithm: str = "HS256" # JWT algorithm (default: HS256)
access_token_expire_minutes: int = 43200 # Token expiry: 30 days
# Gemini AI Configuration
gemini_api_key: str # Google Gemini API key (required)
gemini_model: str = "gemini-2.5-flash-lite" # Default Gemini model
# Server Configuration
host: str = "0.0.0.0" # Server host (default: all interfaces)
port: int = 8000 # Server port (default: 8000)
# Admin Configuration
admin_email: str = ""
# DodoPayments Configuration
dodo_payments_api_key: str = "" # DodoPayments API key
dodo_product_id: str = "" # Pro subscription product ID
dodo_webhook_secret: str = "" # Webhook signature verification secret
# CORS Configuration
# Comma-separated list of allowed origins. Set to "*" for development.
# Example: "https://cortex.example.com,https://www.cortex.example.com"
allowed_origins: str = "*"
class Config:
env_file = ".env"
case_sensitive = False
@lru_cache()
def get_settings():
"""Create and cache settings instance.
Uses LRU cache to ensure settings are only loaded once,
improving performance and consistency across the application.
Returns:
Settings: Cached settings instance
"""
return Settings()
# Global settings instance used throughout the application
settings = get_settings()