"""
Configuration settings for the Malware Website Crawler
"""
import os
from dotenv import load_dotenv

load_dotenv()

class Config:
    # Flask Configuration
    SECRET_KEY = os.environ.get('SECRET_KEY') or 'dev-secret-key-change-in-production'
    
    # Database Configuration
    DATABASE_URL = os.environ.get('DATABASE_URL') or 'postgresql://user:password@localhost/malware_crawler'
    
    # Redis Configuration for Celery
    REDIS_URL = os.environ.get('REDIS_URL') or 'redis://localhost:6379/0'
    CELERY_BROKER_URL = REDIS_URL
    CELERY_RESULT_BACKEND = REDIS_URL
    
    # AWS Configuration
    AWS_REGION = os.environ.get('AWS_REGION') or 'us-east-1'
    AWS_ACCESS_KEY_ID = os.environ.get('AWS_ACCESS_KEY_ID')
    AWS_SECRET_ACCESS_KEY = os.environ.get('AWS_SECRET_ACCESS_KEY')
    
    # S3 Configuration for file storage
    S3_BUCKET = os.environ.get('S3_BUCKET') or 'malware-crawler-files'
    
    # Security Configuration
    ALLOWED_IPS = os.environ.get('ALLOWED_IPS', '').split(',')
    MAX_FILE_SIZE = int(os.environ.get('MAX_FILE_SIZE', 50 * 1024 * 1024))  # 50MB
    
    # Crawler Configuration
    MAX_DEPTH = int(os.environ.get('MAX_DEPTH', 3))
    MAX_PAGES = int(os.environ.get('MAX_PAGES', 100))
    CRAWL_DELAY = float(os.environ.get('CRAWL_DELAY', 1.0))
    
    # Analysis Configuration
    VIRUSTOTAL_API_KEY = os.environ.get('VIRUSTOTAL_API_KEY')
    SHODAN_API_KEY = os.environ.get('SHODAN_API_KEY')
    
    # Sandbox Configuration
    SANDBOX_TIMEOUT = int(os.environ.get('SANDBOX_TIMEOUT', 300))  # 5 minutes
    SANDBOX_MEMORY_LIMIT = int(os.environ.get('SANDBOX_MEMORY_LIMIT', 512))  # 512MB
    
    # Logging Configuration
    LOG_LEVEL = os.environ.get('LOG_LEVEL', 'INFO')
    LOG_FILE = os.environ.get('LOG_FILE', 'crawler.log')
