from newsreader.conf.utils import get_env

from .base import *  # noqa: F403
from .utils import get_current_version


DEBUG = False

SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")

ADMINS = [
    ("", email) for email in get_env("ADMINS", split=",", required=False, default=[])
]

# Project settings
VERSION = get_current_version(debug=False)
ENVIRONMENT = "production"

# Third party settings
AXES_HANDLER = "axes.handlers.database.AxesDatabaseHandler"

# Optionally use sentry integration
try:
    from sentry_sdk import init as sentry_init

    SENTRY_CONFIG.update(  # noqa: F405
        {"release": VERSION, "environment": ENVIRONMENT, "debug": False}
    )

    sentry_init(**SENTRY_CONFIG)  # noqa: F405
except ImportError:
    pass
