import os from datetime import timedelta BASE_DIR = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) class Config: SECRET_KEY = os.environ.get('SECRET_KEY', 'leadradar-super-secret-key-change-in-prod') JWT_SECRET_KEY = os.environ.get('JWT_SECRET_KEY', 'jwt-super-secret-key-leadradar-2026') JWT_ACCESS_TOKEN_EXPIRES = timedelta(hours=8) JWT_REFRESH_TOKEN_EXPIRES = timedelta(days=7) # Database configuration (PostgreSQL in docker / SQLite in dev-test) SQLALCHEMY_DATABASE_URI = os.environ.get( 'DATABASE_URL', f'sqlite:///{os.path.join(BASE_DIR, "leadradar.db")}' ) # Fix postgres:// URL prefix if provided by legacy hosting platforms if SQLALCHEMY_DATABASE_URI.startswith("postgres://"): SQLALCHEMY_DATABASE_URI = SQLALCHEMY_DATABASE_URI.replace("postgres://", "postgresql://", 1) SQLALCHEMY_TRACK_MODIFICATIONS = False # Scraper config PLAYWRIGHT_HEADLESS = os.environ.get('PLAYWRIGHT_HEADLESS', 'true').lower() in ('true', '1', 't') PLAYWRIGHT_TIMEOUT = int(os.environ.get('PLAYWRIGHT_TIMEOUT', '30000')) # Integration secret N8N_WEBHOOK_SECRET = os.environ.get('N8N_WEBHOOK_SECRET', 'n8n-webhook-default-secret') class TestConfig(Config): TESTING = True SQLALCHEMY_DATABASE_URI = 'sqlite:///:memory:' JWT_SECRET_KEY = 'test-jwt-secret-key-32-bytes-minimum-length-leadradar' SECRET_KEY = 'test-secret-key-32-bytes-minimum-length-leadradar' WTF_CSRF_ENABLED = False