#config/settings/prod.py
from .base import *
from decouple import config

csv_list = lambda value: [item.strip() for item in value.split(',') if item.strip()]

DEBUG = False

ALLOWED_HOSTS = config("ALLOWED_HOSTS", cast=csv_list)

CORS_ALLOWED_ORIGINS = config("CORS_ALLOWED_ORIGINS", cast=csv_list)

CORS_ALLOW_CREDENTIALS = True

CSRF_TRUSTED_ORIGINS = config(
    "CSRF_TRUSTED_ORIGINS",
    default="",
    cast=csv_list,
)

SECURE_SSL_REDIRECT = config("SECURE_SSL_REDIRECT", default=True, cast=bool)
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True

SECURE_HSTS_SECONDS = config("SECURE_HSTS_SECONDS", default=31536000, cast=int)
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_PRELOAD = True

SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
