config.py•959 B
"""Configuration management for GitHub Stars MCP Server."""
from pydantic import field_validator
from pydantic_settings import BaseSettings
class Settings(BaseSettings):
"""Application settings with environment variable support."""
github_token: str
log_level: str = "INFO"
dangerously_omit_auth: bool = True
@field_validator("log_level")
@classmethod
def validate_log_level(cls, v: str) -> str:
"""Validate and normalize log level."""
valid_levels = {"DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"}
normalized = v.upper()
if normalized not in valid_levels:
raise ValueError(f"Invalid log level: {v}. Must be one of {valid_levels}")
return normalized
#
# class Config:
# """Pydantic configuration."""
#
# env_file = ".env"
# env_file_encoding = "utf-8"
# case_sensitive = False
# Global settings instance
settings = Settings()