import os from os import getenv APP_NAME = 'delphi_es_utils' ENVIRONMENT = getenv('ENVIRONMENT', 'qa') TEMP_DIR = '/tmp' #: Profiling ENABLE_PROFILING = getenv('PROFILE_ENABLE', 'false').lower() == 'true' #: Log level config DEBUG = getenv('DEBUG', 'false').lower() == 'true' or ENABLE_PROFILING LOG_LEVEL = getenv('LOG_LEVEL', ('DEBUG' if DEBUG else 'INFO')) ES_LOG_LEVEL = getenv('ELASTICSEARCH_LOG_LEVEL', ('DEBUG' if DEBUG else 'WARN')) # Path constants PKG_PATH = os.path.dirname(os.path.abspath(__file__)) ROOT_PATH = os.path.dirname(PKG_PATH) VERSION_FILE_PATH = os.path.join(ROOT_PATH, 'VERSION') INDEX_MAPPINGS_PATH = os.path.join(ROOT_PATH, 'indices') # -------------------- Elasticsearch -------------------- # # these are mainly to aid testing locally and may become invalid destinations ES_HOST_DEV = 'vpc-dev-delphi-search-wqvxmv3fjucs7qeydrb4o6zw5q.us-east-1.es.amazonaws.com' ES_HOST_QA = 'vpc-qa-delphi-search-olazvy24seersqvabimnpxzecm.us-east-1.es.amazonaws.com' ES_HOST_STAGE = 'vpc-stage-delphi-search-kssthemcj2ebjshnnzaqu6ky7q.us-east-1.es.amazonaws.com' ES_HOST_PROD = 'vpc-prod-delphi-search-bplxqbgg3vwknlnwgu6btxejey.us-east-1.es.amazonaws.com' ES_ENV_HOSTS = { 'dev': ES_HOST_DEV, 'qa': ES_HOST_QA, 'stage': ES_HOST_STAGE, 'prod': ES_HOST_PROD, } ELASTICSEARCH_HOST = getenv('ELASTICSEARCH_HOST', ES_ENV_HOSTS.get(ENVIRONMENT, ES_HOST_DEV)) ELASTICSEARCH_PORT = int(getenv('ELASTICSEARCH_PORT', '443')) ES_BULK_CHUNK_SIZE = int(getenv('ELASTICSEARCH_BULK_CHUNK_SIZE', '200')) #: Reindexing config ES_REINDEX_SCROLL_SIZE = int(getenv('ELASTICSEARCH_REINDEX_SCROLL_SIZE', '1000')) #: AWS configuration AWS_DEFAULT_REGION = getenv('AWS_DEFAULT_REGION', 'us-east-1') #: AWS secret name for the secret containing the postgres db credentials DB_CREDS_SECRET_NAME = getenv('DB_CREDS_SECRET_NAME', f'delphi/{ENVIRONMENT}/api/db_params') #: Sentry DSN key https://@sentry.io/ SENTRY_DSN = getenv('SENTRY_DSN') SENTRY_ENABLE = getenv('SENTRY_ENABLE', 'true').lower() == 'true' and bool(SENTRY_DSN) SENTRY_PROJECT = getenv('SENTRY_PROJECT', APP_NAME) LIFECYCLE_POLICY_ID = 'linkfire-lifecycle'