rapid interations of server side app and firefox extension
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
"""Application configuration using pydantic-settings."""
|
||||
|
||||
from functools import lru_cache
|
||||
from pydantic_settings import BaseSettings
|
||||
|
||||
|
||||
class Settings(BaseSettings):
|
||||
"""Application settings loaded from environment variables."""
|
||||
|
||||
# Database
|
||||
database_url: str = "postgresql://gdl:password@localhost:5432/gallery_subscriber"
|
||||
|
||||
# Redis
|
||||
redis_url: str = "redis://localhost:6379/0"
|
||||
|
||||
# Security
|
||||
secret_key: str = "change-me-in-production"
|
||||
# Note: extension_api_key is now stored in database and auto-generated
|
||||
|
||||
# Paths
|
||||
download_path: str = "/data/downloads"
|
||||
config_path: str = "/data/config"
|
||||
cookies_path: str = "/data/cookies"
|
||||
|
||||
# Download settings
|
||||
download_parallel_limit: int = 3
|
||||
download_rate_limit: float = 3.0
|
||||
default_check_interval: int = 3600 # seconds
|
||||
|
||||
# Server
|
||||
host: str = "0.0.0.0"
|
||||
port: int = 8080
|
||||
debug: bool = False
|
||||
log_level: str = "INFO"
|
||||
|
||||
@property
|
||||
def async_database_url(self) -> str:
|
||||
"""Convert database URL to async version for asyncpg."""
|
||||
return self.database_url.replace("postgresql://", "postgresql+asyncpg://")
|
||||
|
||||
class Config:
|
||||
env_file = ".env"
|
||||
env_file_encoding = "utf-8"
|
||||
|
||||
|
||||
@lru_cache
|
||||
def get_settings() -> Settings:
|
||||
"""Get cached settings instance."""
|
||||
return Settings()
|
||||
Reference in New Issue
Block a user