File size: 852 Bytes
4df824f
c90ac2d
4df824f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c90ac2d
adea8c3
4df824f
 
 
 
 
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
from functools import lru_cache
from typing import Optional
from pydantic_settings import BaseSettings, SettingsConfigDict

class Settings(BaseSettings):
    model_config = SettingsConfigDict(env_file=".env", env_file_encoding="utf-8", extra="ignore")

    app_host: str = "0.0.0.0"
    app_port: int = 7860
    app_env: str = "development"

    api_key: str = "changeme"
    api_key_enabled: bool = False

    leaderboard_max_entries: int = 10

    log_level: str = "INFO"

    episode_ttl_seconds: int = 3600        # episodes expire after 1 hour
    rate_limit_per_minute: int = 60        # requests per minute per IP
    
    # Persistence
    database_url: Optional[str] = None
    db_path: str = "./data/codelens.db"
    db_echo: bool = False    # Set True to log all SQL queries

@lru_cache
def get_settings() -> Settings:
    return Settings()