# -*- coding: utf-8 -*-
# type: ignore
from __future__ import annotations

import os

from .base import *  # noqa: F403

DEBUG = (
    os.environ.get('HOTPOCKET_BACKEND_DEBUG', 'false').lower() == 'true'
)

ALLOWED_HOSTS = os.environ.get('HOTPOCKET_BACKEND_ALLOWED_HOSTS', '*').split(',')

INSTALLED_APPS += [  # noqa: F405
    'crispy_forms',
    'crispy_bootstrap5',
    'django_htmx',
]

MIDDLEWARE = [
    'hotpocket_backend.apps.core.middleware.RequestIDMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
    'social_django.middleware.SocialAuthExceptionMiddleware',
    'django_htmx.middleware.HtmxMiddleware',
    'whitenoise.middleware.WhiteNoiseMiddleware',
]

STORAGES['staticfiles'] = {  # noqa: F405
    'BACKEND': 'whitenoise.storage.CompressedManifestStaticFilesStorage',
}

ROOT_URLCONF = 'hotpocket_backend.urls.aio'

UPLOADS_PATH = Path(  # noqa: F405
    os.environ.get(
        'HOTPOCKET_BACKEND_UPLOADS_PATH',
        '/srv/run/uploads',
    ),
)
