import os

USE_LOCAL= os.environ.get('USE_LOCAL', False)

ELASTIC_CO_USERNAME="elastic"
ELASTIC_CO_PASSWORD=os.environ.get("ELASTIC_CO_PASSWORD")
ELASTIC_CO_ENDPOINT_KEY=os.environ.get("ELASTIC_CO_ENDPOINT_KEY")
ELASTICSEARCH_PORT=9243
ELASTIC_HOST_KEY=f"https://{ELASTIC_CO_USERNAME}:{ELASTIC_CO_PASSWORD}@{ELASTIC_CO_ENDPOINT_KEY}:{ELASTICSEARCH_PORT}"

if USE_LOCAL:
    ELASTICSEARCH_PORT = os.environ.get("ELASTICSEARCH_PORT", 9231)
    ELASTIC_HOST_KEY = f"http://localhost:{ELASTICSEARCH_PORT}" # django 500

ELASTICSEARCH_DSL = {
    'default': {
        'hosts': [ELASTIC_HOST_KEY]
    }
}