Fix httpx.Timeout configuration in PyPI proxy
This commit is contained in:
@@ -22,8 +22,8 @@ class Settings(BaseSettings):
|
||||
database_sslmode: str = "disable"
|
||||
|
||||
# Database connection pool settings
|
||||
database_pool_size: int = 5 # Number of connections to keep open
|
||||
database_max_overflow: int = 10 # Max additional connections beyond pool_size
|
||||
database_pool_size: int = 20 # Number of connections to keep open
|
||||
database_max_overflow: int = 30 # Max additional connections beyond pool_size
|
||||
database_pool_timeout: int = 30 # Seconds to wait for a connection from pool
|
||||
database_pool_recycle: int = (
|
||||
1800 # Recycle connections after this many seconds (30 min)
|
||||
@@ -51,6 +51,26 @@ class Settings(BaseSettings):
|
||||
presigned_url_expiry: int = (
|
||||
3600 # Presigned URL expiry in seconds (default: 1 hour)
|
||||
)
|
||||
pypi_download_mode: str = "redirect" # "redirect" (to S3) or "proxy" (stream through Orchard)
|
||||
|
||||
# HTTP Client pool settings
|
||||
http_max_connections: int = 100 # Max connections per pool
|
||||
http_max_keepalive: int = 20 # Keep-alive connections
|
||||
http_connect_timeout: float = 30.0 # Connection timeout seconds
|
||||
http_read_timeout: float = 60.0 # Read timeout seconds
|
||||
http_worker_threads: int = 32 # Thread pool for blocking ops
|
||||
|
||||
# Redis cache settings
|
||||
redis_host: str = "localhost"
|
||||
redis_port: int = 6379
|
||||
redis_db: int = 0
|
||||
redis_password: Optional[str] = None
|
||||
redis_enabled: bool = True # Set False to disable caching
|
||||
|
||||
# Cache TTL settings (seconds, 0 = no expiry)
|
||||
cache_ttl_index: int = 300 # Package index pages: 5 min
|
||||
cache_ttl_versions: int = 300 # Version listings: 5 min
|
||||
cache_ttl_upstream: int = 3600 # Upstream source config: 1 hour
|
||||
|
||||
# Logging settings
|
||||
log_level: str = "INFO" # DEBUG, INFO, WARNING, ERROR, CRITICAL
|
||||
@@ -64,6 +84,15 @@ class Settings(BaseSettings):
|
||||
# Global cache settings override (None = use DB value, True/False = override DB)
|
||||
cache_auto_create_system_projects: Optional[bool] = None # Override auto_create_system_projects
|
||||
|
||||
# PyPI Cache Worker settings
|
||||
pypi_cache_workers: int = 5 # Number of concurrent cache workers
|
||||
pypi_cache_max_depth: int = 10 # Maximum recursion depth for dependency caching
|
||||
pypi_cache_max_attempts: int = 3 # Maximum retry attempts for failed cache tasks
|
||||
|
||||
# Auto-fetch configuration for dependency resolution
|
||||
auto_fetch_dependencies: bool = False # Server default for auto_fetch parameter
|
||||
auto_fetch_timeout: int = 300 # Total timeout for auto-fetch resolution in seconds
|
||||
|
||||
# JWT Authentication settings (optional, for external identity providers)
|
||||
jwt_enabled: bool = False # Enable JWT token validation
|
||||
jwt_secret: str = "" # Secret key for HS256, or leave empty for RS256 with JWKS
|
||||
@@ -88,6 +117,24 @@ class Settings(BaseSettings):
|
||||
def is_production(self) -> bool:
|
||||
return self.env.lower() == "production"
|
||||
|
||||
@property
|
||||
def PORT(self) -> int:
|
||||
"""Alias for server_port for compatibility."""
|
||||
return self.server_port
|
||||
|
||||
# Uppercase aliases for PyPI cache settings (for backward compatibility)
|
||||
@property
|
||||
def PYPI_CACHE_WORKERS(self) -> int:
|
||||
return self.pypi_cache_workers
|
||||
|
||||
@property
|
||||
def PYPI_CACHE_MAX_DEPTH(self) -> int:
|
||||
return self.pypi_cache_max_depth
|
||||
|
||||
@property
|
||||
def PYPI_CACHE_MAX_ATTEMPTS(self) -> int:
|
||||
return self.pypi_cache_max_attempts
|
||||
|
||||
class Config:
|
||||
env_prefix = "ORCHARD_"
|
||||
case_sensitive = False
|
||||
|
||||
Reference in New Issue
Block a user