"""Development settings."""
from .base import *
from .amazon_s3 import *
import sentry_sdk
from sentry_sdk.integrations.django import DjangoIntegration

ALLOWED_HOSTS = ['gm.id-east.ru', '95.213.204.126', '0.0.0.0']

CSRF_TRUSTED_ORIGINS = ['.gm.id-east.ru', ]

SEND_SMS = False
SMS_CODE_SHOW = True
USE_CELERY = True

SCHEMA_URI = 'http'
DEFAULT_SUBDOMAIN = 'www'
SITE_DOMAIN_URI = 'id-east.ru'
DOMAIN_URI = 'gm.id-east.ru'


CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
    },
    'es_queue': {
        'BACKEND': 'django_redis.cache.RedisCache',
        'LOCATION': 'redis://localhost:6379/2'
    }
}


# ELASTICSEARCH SETTINGS
ELASTICSEARCH_DSL = {
    'default': {
        'hosts': '188.68.209.124:9200'
        # 'hosts': 'elasticsearch:9200'
    }
}


ELASTICSEARCH_INDEX_NAMES = {
    'search_indexes.documents.news': 'development_news',
    'search_indexes.documents.establishment': 'development_establishment',
    'search_indexes.documents.product': 'development_product',
    'search_indexes.documents.tag_category': 'development_tag_category',
}

# ELASTICSEARCH_DSL_AUTOSYNC = False

sentry_sdk.init(
    dsn="https://35d9bb789677410ab84a822831c6314f@sentry.io/1729093",
    integrations=[DjangoIntegration()]
)


# DATABASE
DATABASES.update({
    'legacy': {
        'ENGINE': 'django.db.backends.mysql',
        'HOST': os.environ.get('MYSQL_HOSTNAME'),
        'PORT': os.environ.get('MYSQL_PORT'),
        'NAME': os.environ.get('MYSQL_DATABASE'),
        'USER': os.environ.get('MYSQL_USER'),
        'PASSWORD': os.environ.get('MYSQL_PASSWORD')
    }})


# INSTALLED APPS
INSTALLED_APPS.append('transfer.apps.TransferConfig')


BROKER_URL = 'redis://localhost:6379/1'
CELERY_RESULT_BACKEND = BROKER_URL
CELERY_BROKER_URL = BROKER_URL

COOKIE_DOMAIN = '.id-east.ru'
