Skip to content

Commit

Permalink
Reduce redundant variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
sarayourfriend committed Sep 18, 2023
1 parent fa1501f commit a20c35a
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions ingestion_server/ingestion_server/es_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,11 @@ def _elasticsearch_connect() -> Elasticsearch:
:return: an Elasticsearch client
"""

elasticsearch_scheme = config("ELASTICSEARCH_SCHEME", default="http://")
elasticsearch_url = config("ELASTICSEARCH_URL", default="localhost")
elasticsearch_port = config("ELASTICSEARCH_PORT", default=9200, cast=int)

es_endpoint = "{scheme}{url}:{port}".format(
scheme=elasticsearch_scheme,
url=elasticsearch_url,
port=elasticsearch_port,
)
es_scheme = config("ELASTICSEARCH_SCHEME", default="http://")
es_url = config("ELASTICSEARCH_URL", default="localhost")
es_port = config("ELASTICSEARCH_PORT", default=9200, cast=int)

es_endpoint = f"{es_scheme}{es_url}:{es_port}"

# For AWS IAM access to Elasticsearch
aws_region = config("AWS_REGION", "us-east-1")
Expand All @@ -63,11 +59,11 @@ def _elasticsearch_connect() -> Elasticsearch:

timeout = 12 # hours

log.info(f"Connecting to {elasticsearch_url}:{elasticsearch_port} with AWS auth")
log.info(f"Connecting to {es_endpoint} with AWS auth")
auth = AWSRequestsAuth(
aws_access_key=aws_access_key_id,
aws_secret_access_key=aws_secret_access_key,
aws_host=elasticsearch_url,
aws_host=es_url,
aws_region=aws_region,
aws_service="es",
)
Expand Down

0 comments on commit a20c35a

Please sign in to comment.