import os
import time
from .models import AppSetting

def project_context(request):
    """
    Adds project-specific environment variables and app settings to the template context globally.
    """
    app_settings = AppSetting.objects.first()
    return {
        "project_description": os.getenv("PROJECT_DESCRIPTION", ""),
        "project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
        # Used for cache-busting static assets
        "deployment_timestamp": int(time.time()),
        "app_settings": app_settings,
    }