MogensR's picture
Create config/validators.py
78652e8
raw
history blame
4.37 kB
"""
Development environment configuration for BackgroundFX Pro.
Optimized for local development with debugging and hot-reload enabled.
"""
from dataclasses import dataclass, field
from pathlib import Path
from typing import List
from ..settings import Settings
@dataclass
class DevelopmentSettings(Settings):
"""
Development-specific configuration with relaxed security and debug features.
"""
# Environment
environment: str = "development"
debug: bool = True
# Server settings
host: str = "127.0.0.1"
port: int = 8000
workers: int = 1
reload: bool = True # Hot reload enabled
# Security - Relaxed for development
secret_key: str = "dev-secret-key-not-for-production"
cors_origins: List[str] = field(default_factory=lambda: ["*"]) # Allow all origins
# API settings
api_docs_enabled: bool = True # Enable Swagger UI
# Database - Local PostgreSQL
database_url: str = "postgresql://postgres:postgres@localhost:5432/backgroundfx_dev"
database_echo: bool = True # Log SQL queries
database_pool_size: int = 5
database_max_overflow: int = 10
# MongoDB - Local instance
mongodb_url: str = "mongodb://localhost:27017/backgroundfx_dev"
# Redis - Local instance
redis_url: str = "redis://localhost:6379/0"
redis_max_connections: int = 10
# Storage - Local filesystem for development
storage_backend: str = "local"
local_storage_path: Path = field(default_factory=lambda: Path("./storage/dev"))
# Processing - Smaller limits for development
max_image_size: int = 20 * 1024 * 1024 # 20MB
max_video_size: int = 100 * 1024 * 1024 # 100MB
max_batch_size: int = 10
processing_timeout: int = 120 # 2 minutes
enable_gpu: bool = False # Usually no GPU in dev
gpu_memory_fraction: float = 0.5
# Models - Local directory
models_dir: Path = field(default_factory=lambda: Path("./models"))
model_cache_dir: Path = field(default_factory=lambda: Path("./cache/models"))
# Queue - Local Redis
celery_broker_url: str = "redis://localhost:6379/1"
celery_result_backend: str = "redis://localhost:6379/2"
celery_worker_concurrency: int = 2
celery_task_time_limit: int = 300 # 5 minutes
# JWT - Simple key for development
jwt_secret_key: str = "dev-jwt-secret-key"
jwt_expiration_delta: int = 86400 # 1 day
# Rate limiting - Relaxed for development
rate_limit_enabled: bool = False
rate_limit_requests: int = 10000
rate_limit_window: int = 60
# Monitoring - Disabled in development
sentry_dsn: str = "" # Disabled
prometheus_enabled: bool = False
# Logging - Verbose logging
log_level: str = "DEBUG"
log_file: str = "./logs/dev.log"
# Cache - Shorter TTL for development
cache_ttl: int = 60 # 1 minute
cache_max_entries: int = 100
# CDN - Disabled in development
cdn_enabled: bool = False
cdn_base_url: str = "http://localhost:8000/static"
# Email - Console backend for development
smtp_host: str = "localhost"
smtp_port: int = 1025 # MailHog or similar
smtp_use_tls: bool = False
email_from: str = "dev@localhost"
# Webhooks - Shorter timeouts for development
webhook_timeout: int = 10
webhook_max_retries: int = 1
webhook_retry_delay: int = 1
# Feature flags - Everything enabled for testing
enable_video_processing: bool = True
enable_batch_processing: bool = True
enable_ai_backgrounds: bool = True
enable_webhooks: bool = True
# Development-specific settings
auto_create_test_data: bool = True
mock_external_services: bool = True
enable_profiling: bool = True
enable_debug_toolbar: bool = True
def __post_init__(self):
"""Additional development-specific initialization."""
super().__post_init__()
# Create development directories
for dir_path in [
self.local_storage_path,
self.models_dir,
self.model_cache_dir,
self.log_dir,
self.temp_dir
]:
dir_path.mkdir(parents=True, exist_ok=True)
# Create test data directory
test_data_dir = Path("./test_data")
test_data_dir.mkdir(exist_ok=True)