Skip to content

Commit

Permalink
Trying a different way of passing user/pass
Browse files Browse the repository at this point in the history
  • Loading branch information
chouinar committed Oct 11, 2024
1 parent 8b81deb commit 34d9b52
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions api/src/adapters/search/opensearch_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,12 @@ def _get_connection_parameters(opensearch_config: OpensearchConfig) -> dict[str,
# and should connect using the session credentials
if opensearch_config.search_username and opensearch_config.search_password:
# Get credentials and authorize with AWS Opensearch Serverless (es)
#credentials = boto3.Session().get_credentials()
#auth = opensearchpy.AWSV4SignerAuth(credentials, opensearch_config.aws_region, "es")
auth = (opensearch_config.search_username, opensearch_config.search_password)
credentials = boto3.Session().get_credentials()
auth = opensearchpy.AWSV4SignerAuth(credentials, opensearch_config.aws_region, "es")
params["http_auth"] = auth

# TODO hacky - do this a better way
path = f"https://{opensearch_config.search_username}:{opensearch_config.search_password}@{opensearch_config.search_endpoint}:{opensearch_config.search_port}"
params["hosts"] = [path]

return params

0 comments on commit 34d9b52

Please sign in to comment.