24f3001764/llm_code_deployment-1
0
1import os2from dotenv import load_dotenv3 4load_dotenv()5 6 7class Config:8 """Application configuration"""9 10 # Student credentials11 STUDENT_SECRET = os.getenv("STUDENT_SECRET", "")12 13 # API keys14 OPENAI_API_KEY = os.getenv("OPENAI_API_KEY", "")15 GITHUB_TOKEN = os.getenv("GITHUB_TOKEN", "")16 GITHUB_USERNAME = os.getenv("GITHUB_USERNAME", "")17 18 # API settings19 API_HOST = os.getenv("API_HOST", "0.0.0.0")20 API_PORT = int(os.getenv("PORT", "7860"))21 22 # Directories23 GENERATED_APPS_DIR = "generated_apps"24 TEMP_ATTACHMENTS_DIR = "temp_attachments"25 26 # Timeouts27 EVALUATION_TIMEOUT = 600 # 10 minutes28 RETRY_DELAYS = [1, 2, 4, 8, 16] # exponential backoff in seconds29 30 @classmethod31 def validate(cls):32 """Validate required configuration"""33 errors = []34 if not cls.STUDENT_SECRET:35 errors.append("STUDENT_SECRET not set")36 if not cls.OPENAI_API_KEY:37 errors.append("OPENAI_API_KEY not set")38 if not cls.GITHUB_TOKEN:39 errors.append("GITHUB_TOKEN not set")40 if not cls.GITHUB_USERNAME:41 errors.append("GITHUB_USERNAME not set")42 43 if errors:44 raise ValueError(f"Configuration errors: {', '.join(errors)}")45 46 47config = Config()48 